去评论
dz插件网

forum_thread主题表频繁锁表,有什么好办法么?

哥斯拉
2022/05/08 10:37:34
forum_thread(myisam)表大概1.6G大小,频繁的被锁表,而且mysql的慢查询几乎都和这个表有关系,类似的慢查询记录:

# Time: 2022-05-08T01:51:00.188791Z

# User@Host: ****@localhost [127.0.0.1]  Id: 880133

# Query_time: 3.783841  Lock_time: 0.094868 Rows_sent: 1  Rows_examined: 1816276

SET timestamp=1651974660;

SELECT t.tid, t.closed, t.author, t.authorid FROM forum_thread tWHERE  t.fid IN('176','183','166','147','174','31','56','77','78','80','76','158','160','167','171','178','179','240','241','247','248','249','262','282','156','74','70','71','72','73','69','97','161','86','136','169','173','175','92','94','182','281','159','285','88','89','90','48','25','21')AND t.displayorder>='0' AND (0 OR t.subject LIKE '*****') ORDER BY tidDESC LIMIT 500;



之前尝试给dateline加了索引,情况有轻微的改善,看上面的记录应该都是和搜索有关系的,论坛已经限制仅仅能搜索主题,但就这样如果还因为搜索频繁锁表的话,总不能禁止了搜索功能……



请高手指点一下,万分感谢!!!!!!!!!!!!!!