~/talk

Histograms in MySQL and MariaDB

slides:none on file

MariaDB has had histograms since 10.0, stores compact histograms in mysql.column_stats (about 225 bytes) and collects them only via full table scan using ANALYZE TABLE (manual), with precision limits from bucket-count encoding. PostgreSQL keeps an MCV list plus a bucketed histogram and uses sampling plus autovacuum ANALYZE. MySQL 8.0 adds histogram scaffolding in mysql.column_stats (JSON) and a sampling API; its design estimates sample size as 300 × buckets = 30,000 rows for 100 buckets, and real-world tests show large errors when rare values sit near very common ones.

AI-written summary · about

  1. 0:00Histograms in databases
  2. 1:04Query optimizers need histograms
  3. 4:16Estimating condition selectivity
  4. 6:43Histogram types and trade-offs
  5. 10:51Histogram collection strategies
  6. 12:19MariaDB histograms overview
  7. 18:34PostgreSQL histogram implementation
  8. 21:26MySQL sampling approach
  9. 25:47Single-column histogram limits
  10. 27:37Histogram accuracy test
  11. 33:49MySQL 8.0 histogram features
  12. 40:41Key conclusions
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.