MyISAM:如何在运行 DELETE 的情况下进行选择而无需锁定等待?
我有一个包含3000万条记录的表,使用MyISAM引擎。我每 15 分钟就会重复执行 DELETE 语句来清除表中的旧记录。
使用:
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM mytable WHERE id=123;
当“DELETE FROM mytable...”正在运行时(需要 30 - 60 秒)。
SELECT 语句会在不加锁的情况下返回脏记录吗?或者是否会遵守表锁并等待 30 秒然后返回结果?有没有办法让 MyISAM 表在 DELETE 有表锁时返回 SELECT 查询?
谢谢。
I have a table with 30 million records, using MyISAM engine. I have recurrent DELETE statements every 15 minutes to clean the table from old records.
Using:
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM mytable WHERE id=123;
while a 'DELETE FROM mytable...' is running (which takes from 30 - 60 seconds).
Will the SELECT statement return dirty records without locking? Or will the table lock be respected and wait 30 seconds then return the results? Is there a way to get a MyISAM table to return SELECT queries while DELETE has a table lock?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以使用
u can use