0
部分查詢:索引這個查詢
FROM
pm_data AS pmdata
LEFT JOIN messages as pm
ON pmdata.msg_id = pm.msg_id
LEFT JOIN users as usr
ON (usr.uid = pm.reciever_id || usr.uid = pm.sender_id)
WHERE
(
pmdata.sender_id = 541839243781
AND
pmdata.sender_isdeleted = 1
)
OR
(
pmdata.reciever_id = 541839243781
AND
pmdata.reciever_isDeleted = 1
)
ORDER BY pm.created_at DESC
,此刻我只添加
- 索引1(MSG_ID)
- 索引2(sender_isDeleted)
那麼你的問題是什麼? – 2012-03-15 06:48:12
這個查詢需要0,0014在其他情況下需要幾乎0,004加載...我想如果我可以索引它/優化它更好的加載時間 – fxuser 2012-03-15 06:50:26
1.4毫秒是不慢。 – 2012-03-15 06:52:57