Innodb 和 Mysql 索引不一致

栏目: 数据库 · 发布时间: 7年前

内容简介:客户反馈建立索引时报错,具体错误如下:查了下 mysql 官网的解释是说是索引没同步,导致 Innodb 和数据字典的内容不一致,这种情况建议关闭表后等待索引同步就好了 但是我们这边禁止了关闭表的命令。这个是MySQL常见问题。应该是用户执行建索引ddl的时候,退出了或者出现异常导致的。

客户反馈建立索引时报错,具体错误如下:

[ERROR] Table db/table contains 7 indexes inside InnoDB, which is different from the number of indexes 6 defined in the MySQL

查了下 mysql 官网的解释是说是索引没同步,导致 Innodb 和数据字典的内容不一致,这种情况建议关闭表后等待索引同步就好了 但是我们这边禁止了关闭表的命令。

这个是MySQL常见问题。应该是用户执行建索引ddl的时候,退出了或者出现异常导致的。

如果 flush table 搞不定,需要alter table的话,让用户来执行

ALTER TABLE table_name ENGINE=Innodb;

但是执行 DDL 语句是有代价的,需要考虑客户是否一直用这个表,能重启最好,但是如果是 cache 的问题,那么直接 重启就好,如果是文件不一致还是需要执行 ALTER TABLE table_name ENGINE=Innodb;

参考: https://www.percona.com/blog/2011/11/29/innodb-vs-mysql-index-counts/


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Probabilistic Method Second Edition

The Probabilistic Method Second Edition

Noga Alon、Joel H. Spencer / Wiley-Blackwell / 2000 / $121.95

The leading reference on probabilistic methods in combinatorics-now expanded and updated When it was first published in 1991, The Probabilistic Method became instantly the standard reference on one......一起来看看 《The Probabilistic Method Second Edition》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器