Bug #34488 | Cardinality stats wrong after first analyze against MyISAM table | ||
---|---|---|---|
Submitted: | 12 Feb 2008 12:50 | Modified: | 31 Oct 2008 19:24 |
Reporter: | Mark Leith | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: MyISAM storage engine | Severity: | S3 (Non-critical) |
Version: | 5.0.54 | OS: | Any |
Assigned to: | V Venkateswaran | CPU Architecture: | Any |
[12 Feb 2008 12:50]
Mark Leith
[31 Oct 2008 19:24]
V Venkateswaran
Statistics is documented to be updated on ANALYZE. Between ANALYZE calls the engine doesn't have to keep statistics up to date. Not a bug.
[31 Oct 2008 19:46]
Valeriy Kravchuk
"Between ANALYZE calls the engine doesn't have to keep statistics up to date." I agree with the above. Statistics may (and should!) remain the same as it was immediately after previous ANALYZE. Why it changes for MyISAM table, becoming totally incorrect? It should just not change at all. So, I still think this is a bug.
[31 Oct 2008 19:50]
Mark Callaghan
I think this is still a bug. If index stats are allowed to become bogus, then analyze needs to be run all of the time. The alternative is to update the docs to describe the current behavior.
[31 Oct 2008 20:35]
Sergei Golubchik
Valeriy: There's some piece of statistics that MyISAM updates only on ANALYZE. And another one - number of records in the table - that it keeps always up-to-date. Cardinality depends on both, that's why you see it changing. Mark: No. What MyISAM remembers value distribution, and it is far more stable than cardinality, if the table is reasonably big, one doesn't need to run ANALYZE often. Once a year is enough, perhaps. Of course, if the table is small - 5 rows in the test case - and you add 4 times as much rows with completely different value distribution, you have to re-run ANALYZE.