Re:How We Built a Cost-Based SQL Optimizer
by ryanworl on Thursday November 08, 2018 @02:51PM
(#18409352)
How do you manage statistics in the system catalog in CockroachDB?
[ Parent
| on HN ]
Re:How We Built a Cost-Based SQL Optimizer
by radub on Thursday November 08, 2018 @03:45PM
(#18409831)
[Cockroach Labs engineer here, I worked on statistics]
All table statistics are stored in a system table (system.table_statistics). CREATE STATISTICS scans the table, calculating statistics on a column, and adds a new row to system.table_statistics.
We still have a ways to go in making statistics automatic (right now it requires a manual call to CREATE STATISTICS) and more useful to the optimizer (which currently only uses basic stats). We're working on that right now for the 2.2 release.
Re:How We Built a Cost-Based SQL Optimizer
by SaifAlHarthi on Friday November 09, 2018 @01:16PM
(#18416525)
What if the tables were partitioned, do you calculate local statistics or you aggregate the stats and expose it to the optimizer?