Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[求助] CPU占用超高,谁来帮忙分析下MYSQL慢查询日志

[复制链接]
wtc930 发表于 2009-8-24 12:29:03 | 显示全部楼层 |阅读模式
论坛版本是dz7.0正式版,数据库500多M, 以前使用得好好的,这段时间流量增加了一些,站长统计到的15分钟在线在500左右.cpu就时不时的100%.
查看进程,w3wp.exe这个进程时不时吃了cpu100%
网上找了很多方法,也给数据库安装了索引.但都无效,只有开启二次请求后,CPU会好一些,不会升太高上去.
按照说明开启了日志慢查询,帮忙分析下看看是什么情况,下面只附了最新的一部分上来.都是慢于2秒的,如果需要可以附上更多日志!
                        LIMIT 26;
# Time: 090824 10:30:50
# User@Host: sq_qqtbw[sq_qqtbw] @ localhost [127.0.0.1]
# Query_time: 6  Lock_time: 0  Rows_sent: 1  Rows_examined: 799
use sq_qqtbw;
SELECT count(*) FROM `sq_qqtbw`.uc_pms WHERE (related='0' AND msgfromid>'0' OR msgfromid='0') AND msgtoid='4254' AND folder='inbox' AND new='1';
# Time: 090824 10:58:14
# User@Host: 66230[66230] @ localhost [127.0.0.1]
# Query_time: 8  Lock_time: 0  Rows_sent: 1  Rows_examined: 4720
use 66230;
select count(*) as total from phome_enewsgbook where bid='1' and checked=0;
# Time: 090824 11:01:03
# User@Host: fz60[fz60] @ localhost [127.0.0.1]
# Query_time: 4  Lock_time: 0  Rows_sent: 10  Rows_examined: 1350
use fz60;
SELECT p.*, m.uid, m.username, m.groupid, m.adminid, m.regdate, m.lastactivity, m.posts, m.digestposts, m.oltime,
                m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5, m.extcredits6,
                m.extcredits7, m.extcredits8, m.email, m.gender, m.showemail, m.invisible, mf.nickname, mf.site,
                mf.icq, mf.qq, mf.yahoo, mf.msn, mf.taobao, mf.alipay, mf.location, mf.medals,
                mf.sightml AS signature, mf.customstatus, mf.spacename
                FROM cdb_posts p
                LEFT JOIN cdb_members m ON m.uid=p.authorid
                LEFT JOIN cdb_memberfields mf ON mf.uid=m.uid
               
                WHERE p.tid='77334'AND p.invisible='0'   ORDER BY dateline LIMIT 440, 10;
# Time: 090824 11:04:18
# User@Host: sq_qqtbw[sq_qqtbw] @ localhost [127.0.0.1]
# Query_time: 5  Lock_time: 0  Rows_sent: 4  Rows_examined: 1482
use sq_qqtbw;
SELECT p.*, m.uid, m.username, m.groupid, m.adminid, m.regdate, m.lastactivity, m.posts, m.digestposts, m.oltime,
                m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5, m.extcredits6,
                m.extcredits7, m.extcredits8, m.email, m.gender, m.showemail, m.invisible, mf.nickname, mf.site,
                mf.icq, mf.qq, mf.yahoo, mf.msn, mf.taobao, mf.alipay, mf.location, mf.medals,
                mf.sightml AS signature, mf.customstatus, mf.spacename , mf.field_1
                FROM cdb_posts p
                LEFT JOIN cdb_members m ON m.uid=p.authorid
                LEFT JOIN cdb_memberfields mf ON mf.uid=m.uid
               
                WHERE p.tid='16427'AND p.invisible='0'   ORDER BY dateline LIMIT 490, 10;
# User@Host: sq_qqtbw[sq_qqtbw] @ localhost [127.0.0.1]
# Query_time: 5  Lock_time: 0  Rows_sent: 4  Rows_examined: 1482
SELECT p.*, m.uid, m.username, m.groupid, m.adminid, m.regdate, m.lastactivity, m.posts, m.digestposts, m.oltime,
                m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5, m.extcredits6,
                m.extcredits7, m.extcredits8, m.email, m.gender, m.showemail, m.invisible, mf.nickname, mf.site,
                mf.icq, mf.qq, mf.yahoo, mf.msn, mf.taobao, mf.alipay, mf.location, mf.medals,
                mf.sightml AS signature, mf.customstatus, mf.spacename , mf.field_1
                FROM cdb_posts p
                LEFT JOIN cdb_members m ON m.uid=p.authorid
                LEFT JOIN cdb_memberfields mf ON mf.uid=m.uid
               
                WHERE p.tid='16427'AND p.invisible='0'   ORDER BY dateline LIMIT 490, 10;
# Time: 090824 11:04:19
# User@Host: sq_qqtbw[sq_qqtbw] @ localhost [127.0.0.1]
# Query_time: 4  Lock_time: 0  Rows_sent: 6  Rows_examined: 1128
SELECT p.*, m.uid, m.username, m.groupid, m.adminid, m.regdate, m.lastactivity, m.posts, m.digestposts, m.oltime,
                m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5, m.extcredits6,
                m.extcredits7, m.extcredits8, m.email, m.gender, m.showemail, m.invisible, mf.nickname, mf.site,
                mf.icq, mf.qq, mf.yahoo, mf.msn, mf.taobao, mf.alipay, mf.location, mf.medals,
                mf.sightml AS signature, mf.customstatus, mf.spacename , mf.field_1
                FROM cdb_posts p
                LEFT JOIN cdb_members m ON m.uid=p.authorid
                LEFT JOIN cdb_memberfields mf ON mf.uid=m.uid
               
                WHERE p.tid='74074'AND p.invisible='0'   ORDER BY dateline LIMIT 370, 10;
zwflss 发表于 2009-8-24 15:52:51 | 显示全部楼层
你这是w3wp.exe占用CPU高还是mysql占用CPU高? 我咋看着你说是w3wp.exe高,也没发mysql高不高
回复

使用道具 举报

 楼主| wtc930 发表于 2009-8-25 14:09:18 | 显示全部楼层
mysql还好,主要是w3wp.exe占用的高!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-11-17 10:55 , Processed in 0.022181 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表