Hacker News new | ask | show | jobs
by jclulow 2685 days ago
One challenge with that is that the query plan often depends on the current table composition statistics. If a value is relatively common (or uncommon), or the size of the table has grown or shrunk, you may end up with a materially different (and conceivably substantially worse) plan.
1 comments

I can't tell you how many times over 20 years I've heard a DBA tell me "the statistics weren't updated" after an incident.
I've written cron jobs to update mysql statistics to prevent it from choosing bad query plans. It's as terrible as it sounds.
How come it's not automatic and built-in? Why is a script terrible? (Does it have to enumerate all tables and piecewise run the stat update?)
Yes, the stats update is per table. We only updated it for a few tables we really cared about.
This is my reason for preferring NOSQL where possible.