为什么我的 MySQL 索引基数被清零?
我有一个使用 MySQL 数据库 (MYISAM) 的旧 Web 应用程序。我最近注意到应用程序的性能急剧下降。检查我的索引后,我注意到所有索引的基数都报告为零。
我可以通过对每个表执行 ANALYZE TABLE 来解决此问题。
但我很好奇,是什么导致基数首先被清零?
I have an older web application that uses a MySQL Database (MYISAM). I noticed recently that the performance of the application was drastically reduced. After checking on my indexes, I noticed that the cardinality for all of them was reporting zero.
I was able to fix this by doing an ANALYZE TABLE on each table.
But I'm curious, what causes the cardinality to get zeroed out in the first place?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从内存中,某些修复表操作会擦除统计信息,您需要分析表才能恢复它们。
除此之外,我想不出任何应该将它们归零的原因。我只是希望它们会过时。
From memory, some repair table operations wipe the statistics and you need to ANALYZE TABLE to get them back.
Other than that, I can't think of any reason why they should be zeroed. I'd just expect that they'd be out of date.