简体   繁体   English

InnoDB MySQL是否自动使用行级锁定?

[英]does InnoDB MySQL automatically use row-level locking?

I have a MySQL database that currently uses MyISAM but I am thinking of changing over to InnoDB, because it's quite high traffic and does a lot of writes to the same table, which causes slow loading times for visitors who then have to wait for each write to finish as the whole table is locked. 我有一个当前使用MyISAM的MySQL数据库,但我正在考虑转换为InnoDB,因为它的流量非常大,并且对同一张表进行了大量写入操作,这导致访问者的加载时间变慢,从而使访问者不得不等待每次写入完成整个表被锁定。

If I change to InnoDB, does it automatically use row-level locking instead of table-locking? 如果我改用InnoDB,它会自动使用行级锁定而不是表锁定吗? Or are there any query modifications I have to make. 还是我必须进行任何查询修改。

Thank you :) 谢谢 :)

It has auto row-level locking on write operations. 它具有对写操作的自动行级锁定。 It's better choice over MyIsam if you have more writes then reads. 如果您的写入次数多于读取次数,则比MyIsam更好的选择。 You haven't to change your queries. 您无需更改查询。 But you can make other alter method. 但是您可以制作其他alter方法。 If data that you you insert is not important to see immediately then you can stay on MyISam and use INSERT DELAYED approach. 如果您插入的数据对于立即查看并不重要,则可以继续使用MyISam并使用INSERT DELAYED方法。 We used it in highload project and it works brilliant on very large tables. 我们在高负载项目中使用了它,并且在很大的桌子上也能出色地工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM