EPISODE · Aug 8, 2026 · 9 MIN
Why Database Statistics Need Histograms for Query Plans
from Database Tech with Fexingo: SQL, NoSQL, and Data Storage Conversations · host Fexingo
Episode 149 of Database Tech with Fexingo drills into the hidden cost of missing statistics. Hosts Lucas and Luna explain why database query optimizers rely on histograms to estimate row counts — and what happens when those estimates are stale or missing entirely. Using a concrete example: a customer orders table with 10 million rows and a status column that's 99 percent 'completed' but only 1 percent 'pending'. Lucas walks through how a query for 'pending' orders suffers index scans and nested loops when the optimizer thinks there are 5 million rows instead of 100,000. Luna digs into the mechanics of equi-width versus equi-depth histograms, why NULLs and skewed data break naive estimates, and how auto-update features in Postgres and SQL Server still miss correlation across columns. The episode also covers quick fixes: manual ANALYZE, extended statistics, and sampling rates. Listeners get one concrete takeaway: check your table's last analyze time before debugging a slow query. #DatabaseStatistics #Histograms #QueryOptimizer #RowEstimates #SkewedData #SQLTuning #Postgres #SQLServer #Analyze #QueryPlans #IndexScans #NestedLoops #DataEngineering #DatabasePerformance #Technology #Podcast #FexingoBusiness #BusinessPodcast Keep every episode free: buymeacoffee.com/fexingo
Embed this episode
Ready to play
Why Database Statistics Need Histograms for Query Plans
No transcript for this episode yet
Similar Episodes
Apr 7, 2026 ·14m
Similar Podcasts
No similar podcasts found.