我的網絡主機暫停我的帳戶,由於我的博客造成的MySQL超載。他們問我來檢查慢查詢並解決「索引」他們的問題,但我不能完全明白應該怎麼做這裏:緩慢的MySQL查詢(WordPress的)
# Query_time: 1.116245 Lock_time: 0.000202 Rows_sent: 10 Rows_examined: 3486
use mydbname
select tag, t.tag_id, count(p2t.post_id) as count, ((count(p2t.post_id)/1070)*100) as weight, ((count(p2t.post_id)/109)*100) as relativeweight
from wp_tags t inner join wp_post2tag p2t on t.tag_id = p2t.tag_id
inner join wp_posts p on p2t.post_id = p.ID
WHERE post_date_gmt < '2011-12-06 09:00:01'
AND (post_type = 'post')
group by t.tag
order by weight desc
LIMIT 10
# Tue Dec 6 02:00:08 2011
# Query_time: 6.926785 Lock_time: 1.731793 Rows_sent: 10 Rows_examined: 3486
use mydbname
select tag, t.tag_id, count(p2t.post_id) as count, ((count(p2t.post_id)/1070)*100) as weight, ((count(p2t.post_id)/109)*100) as relativeweight
from wp_tags t inner join wp_post2tag p2t on t.tag_id = p2t.tag_id
inner join wp_posts p on p2t.post_id = p.ID
WHERE post_date_gmt < '2011-12-06 09:00:01'
AND (post_type = 'post')
group by t.tag
order by weight desc
LIMIT 10
我會很感激的任何幫助。
謝謝!
你確定它的UTW?導致其在慢查詢日誌中的幾個查詢中的僅一個:http:// cl。ly/3f3B3d0Q081k1g0i2l1d謝謝! – 3zzy
@Nimbuz好吧,從你的其他評論中解釋說它是一個罪魁禍首,而且它的聲譽相當不好。在慢日誌中,有一些最基本的查詢,沒有真正的理由要執行這麼久 - 除了被長時間運行的UTW查詢阻塞在資源之外。 – Nameless
謝謝你,幫助解決它! – 3zzy