-2
我有這個疑問:MySQL查詢與多個INNER JOIN太慢
$sql="SELECT t1.*, t2.*, t3.*,t4.*,t5.*,t6.*,t7.*,t8.*,t9.asciiname as asciiname_9, t10.asciiname as asciiname_10,t11.*,t12.*
FROM anunturi t1
INNER JOIN tip_proprietate t2
ON t1.tip = t2.id_prop
INNER JOIN anunt_preturi t3
ON t1.id_anunt = t3.ext
INNER JOIN anunturi_images t5
ON t1.id_anunt = t5.id_ext
INNER JOIN tranzactie t4
ON t1.tranzactie = t4.id_tranzactie
INNER JOIN anunt_descriere t6
ON t1.id_anunt = t6.ext
INNER JOIN anunt_locatie t7
ON t1.id_anunt = t7.ext
INNER JOIN zone t8
ON t7.zona = t8.id_zona
INNER JOIN locatii t9
ON t7.judet = t9.admin1_code
AND t9.feature_code='ADM1'
INNER JOIN locatii t10
ON t7.oras = t10.geonameid
INNER JOIN anunt_suprafete t11
ON t1.id_anunt = t11.ext
INNER JOIN tip_locuinta t12
ON t1.tip2 = t12.id_loc
GROUP BY t1.id_anunt
WHERE t1.status=0
ORDER BY t1.id_anunt DESC
LIMIT 3";
,我查詢之前使用SET SQL_BIG_SELECTS=1
。它運行速度很慢。
你有IND exes在你加入的列上?你真的需要所有表中的所有列嗎?這需要多久? – Prix
索引,表格,解釋,廚房水槽。 – Mihai
我有索引列,我需要所有的列。 – user3456749