我有這個疑問,其正在約40-50秒加載我如何優化這個花費很多時間的查詢?
SELECT
members.latitude,
members.longitude,
members.mem_id
FROM members
WHERE profile_type != "C"
AND (gender = 'm'
OR gender = 'f')
AND members.mem_id IN(SELECT DISTINCT
n2.mem_id
FROM network n1,
network n2
WHERE n1.frd_id = n2.mem_id
AND n1.mem_id = '48'
AND n2.frd_id = '48')
ORDER BY profilenam
有其中包含的用戶朋友們
請幫網表..
添加索引到你的表 – 2012-07-25 11:20:02
目前已經有指數在這兩個表 – user1551419 2012-07-25 11:20:44
@ user1551419'AND(性別添加項= 'm' 或性別='f')'這部分似乎是額外的(除非有另一種可能性)。 – Leri 2012-07-25 11:22:41