我的mySql查詢加載速度很慢(超過30秒),我閒逛我可以優化它的任何調整。Mysql查詢優化 - 獲取所有主題的最後一個帖子
查詢應該返回最後一個字符串爲「?」的帖子。的所有線程。
謝謝。
SELECT FeedbackId, ParentFeedbackId, PageId, FeedbackTitle, FeedbackText, FeedbackDate
FROM ReaderFeedback AS c
LEFT JOIN (
SELECT max(FeedbackId) AS MaxFeedbackId
FROM ReaderFeedback
WHERE ParentFeedbackId IS NOT NULL
GROUP BY ParentFeedbackId
) AS d ON d.MaxFeedbackId = c.FeedbackId
WHERE ParentFeedbackId IS NOT NULL
AND FeedbackText LIKE '%?%'
GROUP BY ParentFeedbackId
ORDER BY d.MaxFeedbackId DESC LIMIT 50
代碼優化問題適用於[代碼評論](http://codereview.stackexchange.com)。你可以在那裏發佈。 –