|
比如Dismall网站底部的处理时间是0.03秒左右,我们之前最快也差不多,现在变成了0.07秒左右,不知道是哪里设置没优化好还是数据库问题,已经启用Redis
另外慢查询里发现两个表的时间比较久,表是innodb引擎,请问是那里问题?
- # Time: 2023-12-11T10:52:54.556741Z
- # User@Host: root[root] @ localhost [127.0.0.1] Id: 364698
- # Query_time: 4.171622 Lock_time: 0.000000 Rows_sent: 6 Rows_examined: 629667
- SET timestamp=1702291974;
- SELECT DISTINCT t.*, ti.attachment as attachmenturl, ti.remote
- FROM `pre_forum_thread` t
- INNER JOIN `pre_forum_threadimage` ti ON t.tid=ti.tid WHERE t.readperm='0'
- AND t.fid IN ('37','36','2') AND t.isgroup='0'
- AND t.displayorder>='0'
- ORDER BY t.dateline DESC
- LIMIT 0,6;
- # Time: 2023-12-11T10:52:55.744347Z
- # User@Host: root[root] @ localhost [127.0.0.1] Id: 364782
- # Query_time: 1.078406 Lock_time: 0.000000 Rows_sent: 6 Rows_examined: 156282
- SET timestamp=1702291975;
- SELECT DISTINCT t.*, ti.attachment as attachmenturl, ti.remote
- FROM `pre_forum_thread` t
- INNER JOIN `pre_forum_threadimage` ti ON t.tid=ti.tid WHERE t.readperm='0'
- AND t.fid IN ('37') AND t.isgroup='0'
- AND t.displayorder>='0'
- ORDER BY t.dateline DESC
- LIMIT 0,6;
- # Time: 2023-12-11T10:54:16.983359Z
- # User@Host: root[root] @ localhost [127.0.0.1] Id: 366522
- # Query_time: 1.254606 Lock_time: 0.000000 Rows_sent: 10 Rows_examined: 397061
- SET timestamp=1702292056;
- SELECT DISTINCT t.*
- FROM `pre_forum_thread` t
- WHERE t.readperm='0'
- AND t.fid IN ('82','40','41','44','43','45','63','39','87','64','51','52','88','56','48','57','59','61','60','66','67','68','70','71','72','74','76','93','79') AND t.isgroup='0'
- AND t.displayorder>='0'
- ORDER BY t.dateline DESC
- LIMIT 0,10;
- # Time: 2023-12-11T10:54:18.474966Z
- # User@Host: root[root] @ localhost [127.0.0.1] Id: 366548
- # Query_time: 1.226406 Lock_time: 0.000000 Rows_sent: 10 Rows_examined: 397061
- SET timestamp=1702292058;
- SELECT DISTINCT t.*
- FROM `pre_forum_thread` t
- WHERE t.readperm='0'
- AND t.fid IN ('37','36','2') AND t.special IN ('0') AND t.isgroup='0'
- AND t.displayorder>='0'
- ORDER BY t.dateline DESC
- LIMIT 0,10;
- # Time: 2023-12-11T10:56:56.033320Z
- # User@Host: root[root] @ localhost [127.0.0.1] Id: 369432
- # Query_time: 1.996411 Lock_time: 0.001000 Rows_sent: 3 Rows_examined: 397108
- SET timestamp=1702292216;
- SELECT DISTINCT t.*, ti.attachment as attachmenturl, ti.remote
- FROM `pre_forum_thread` t
- INNER JOIN `pre_forum_threadimage` ti ON t.tid=ti.tid WHERE t.readperm='0'
- AND t.fid IN ('48') AND t.isgroup='0' AND t.dateline >= '1701687413'
- AND t.displayorder>='0'
- ORDER BY t.recommends DESC
- LIMIT 0,3;
- # Time: 2023-12-11T10:57:06.324541Z
- # User@Host: root[root] @ localhost [127.0.0.1] Id: 369624
- # Query_time: 2.121604 Lock_time: 0.000000 Rows_sent: 3 Rows_examined: 397222
- SET timestamp=1702292226;
- SELECT DISTINCT t.*, ti.attachment as attachmenturl, ti.remote
- FROM `pre_forum_thread` t
- INNER JOIN `pre_forum_threadimage` ti ON t.tid=ti.tid WHERE t.readperm='0'
- AND t.fid IN ('51','52','88') AND t.isgroup='0' AND t.dateline >= '1701687424'
- AND t.displayorder>='0'
- ORDER BY t.recommends DESC
- LIMIT 0,3;
复制代码
我知道答案
回答被采纳将会获得 1 贡献 已有3人回答
|
|