爲了提高「大型」數據庫的性能,下列查詢可以更改多少?優化MySQL SELECT查詢?
SELECT SQL_CALC_FOUND_ROWS wp_rb_posts.*
FROM wp_rb_posts
WHERE 1=1
AND ((guid = '956e208f101562f6654e88e9711276e4')
OR (guid = 'http://www.r-bloggers.com/?guid=956e208f101562f6654e88e9711276e4')
OR (guid = 'http://www.r-bloggers.com/?guid=956e208f101562f6654e88e9711276e4')
OR (MD5(guid) = '956e208f101562f6654e88e9711276e4'))
AND wp_rb_posts.post_type
IN ('post', 'page', 'attachment', 'revision', 'nav_menu_item')
AND (wp_rb_posts.post_status = 'publish'
OR wp_rb_posts.post_status = 'future'
OR wp_rb_posts.post_status = 'draft'
OR wp_rb_posts.post_status = 'pending'
OR wp_rb_posts.post_status = 'trash'
OR wp_rb_posts.post_status = 'auto-draft'
OR wp_rb_posts.post_status = 'inherit'
OR wp_rb_posts.post_status = 'private')
ORDER BY wp_rb_posts.post_date DESC LIMIT 1400, 10;
試過'EXPLAIN'但 – Jacco 2011-06-16 20:17:03
請嘗試格式化你的代碼在未來可讀性這是重新格式化_pain_。 – Oded 2011-06-16 20:19:29
Jacco - no。Oded - 對不起,謝謝! – 2011-06-16 20:21:07