如何在MySQL innoDB中重建索引并更新统计信息? [英] How can I rebuild indexes and update stats in MySQL innoDB?

查看:74
本文介绍了如何在MySQL innoDB中重建索引并更新统计信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用MS SQL Server的经验,可以对重建索引.我在MySQL innoDB中找不到这样的选项,有这样的选项吗?如果没有,MySQL数据库如何创建执行计划? MySQL是否通过每次UPDATE和INSERT更新索引和统计信息?

I have experience with MS SQL server where it is possible and useful to update statistic and rebuild indexes. I can't find such option in MySQL innoDB, is there such option? If not, how MySQL database create an execution plan? Does the MySQL update indexes and statistic with every UPDATE and INSERT?

推荐答案

这是通过

ANALYZE TABLE table_name;

此处了解更多信息.

ANALYZE TABLE分析并存储表的密钥分布.在分析过程中,该表被MyISAM,BDB和InnoDB的读锁所锁定.该语句适用于MyISAM,BDB,InnoDB和NDB表.

ANALYZE TABLE analyzes and stores the key distribution for a table. During the analysis, the table is locked with a read lock for MyISAM, BDB, and InnoDB. This statement works with MyISAM, BDB, InnoDB, and NDB tables.

这篇关于如何在MySQL innoDB中重建索引并更新统计信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆