无法使用 InnoDB 在字段上添加索引?
大家好,我有一个 innodb 表,我试图在其上运行索引,但收到以下错误:
Deadlock found when trying to get lock; try restarting transaction
语法是:
ALTER TABLE mytable ADD INDEX (fieldtoindex);
关于为什么会引发死锁错误的任何想法?谢谢!
hey all, I have an innodb table that I'm trying to run an index on and I'm getting the following error:
Deadlock found when trying to get lock; try restarting transaction
The syntax is:
ALTER TABLE mytable ADD INDEX (fieldtoindex);
any ideas as to why that would throw a deadlock error? thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有提供足够的信息来回答您的问题。
对于 InnoDB,作为一般规则,当出现错误时,请查看 SHOW ENGINE INNODB STATUS 的输出。您希望在命令行客户端中运行此命令,并以 \G(反斜杠大写 G)结束命令以使输出可读。
在您的情况下,相关信息将位于 SHOW ENGINE INNODB STATUS 输出的顶部,其中显示类似的信息,
其中列出了相关的表和索引名称,以及所涉及的语句。有了这些信息,您的问题就可以调试了。
另请参阅 http://www.mysqlperformanceblog.com /2006/07/17/show-innodb-status-walk-through/ 了解更多信息。
如果这种情况经常发生,请查看 http://freshmeat.net/projects/innotop, “D”屏(死锁显示)。
You are not providing enough information to answer your question.
With InnoDB, as a general rule, when there is an error, have a look at the output of SHOW ENGINE INNODB STATUS. You want to run this in the command line client, and end the command with \G (backslash upper case G) to make the output readable.
In your case, the relevant information will be at the top of the SHOW ENGINE INNODB STATUS output, where it says something like
This lists the relevant table and index names, as well as the statements involved. With this information your problem becomes debuggable.
See also http://www.mysqlperformanceblog.com/2006/07/17/show-innodb-status-walk-through/ for more information.
If that happens more often, have a look at http://freshmeat.net/projects/innotop, "D" screen (deadlock display).