如何增加這個MySQL查詢的性能如何優化MySQL查詢
SELECT '' AS sharedid,
hubber_posts.userID AS postowner,
hubber_posts.*,
'' AS sharedby,
hubber_posts.userID AS userID,
hubber_posts.posted_date AS DATE,
'' AS sharebyusr,
'' AS sharebyusrimg,
Concat_ws(' ', firstname, lastname) AS fullname,
username AS postedBy,
hubber_user.image,
hubber_user.gender AS gender,
(SELECT accounttype
FROM hubber_user_security us
WHERE hubber_user.ID = us.userID
AND hubber_posts.userID = us.userID) AS accounttype,
'' AS sharebyusrtype
FROM hubber_posts
INNER JOIN hubber_user
ON hubber_posts.userID = hubber_user.ID
WHERE hubber_posts.status = 1
請儘量把一些精力來格式化T他查詢。 –
我投票結束這個問題作爲題外話,因爲性能問題應該包括EXPLAIN ANALYZE和關於表格大小,索引,當前時間表現,慾望時間等的一些信息。慢是一個相對術語,我們需要一個真正的價值來比較。 MySQL也請閱讀[如何 - 問](http://stackoverflow.com/help/how-to-ask) – e4c5
你需要閱讀這個建議提出一個問題,我們可以回答。 http://meta.stackoverflow.com/questions/271055/tips-for-asking-a-good-structured-query-language-sql-question/271056#271056 –