Sorunum, doğru öğeyi almak için birden çok bağlantı seçiyorum ve yapıyorum.Birden çok birleştirme ile MySQL sorgusunu hızlandır
Bunu nasıl hızlandıracağımı bilen var mı? 19 saniye sürüyor mu?
İşte soru.
SELECT
t1.id AS HostingID,
t5.date_id AS DateRelid
FROM
tblhosting AS t1
INNER JOIN tblcustomfieldsvalues AS t2 ON t1.id = t2.relid
INNER JOIN tblcustomfields AS t3 ON t2.fieldid = t3.id
INNER JOIN tbl_course AS t4 ON t1.packageid = t4.course_pid
INNER JOIN tbl_dates AS t5 ON t4.course_title = t5.date_coursetitle
WHERE
t3.fieldname LIKE "%Course Date%" AND
t1.id = "$hostingid" AND
t1.userid = "$userid" AND
t5.date_coursedisplay = t2.value AND
t5.date_courselocation = t4.course_location
ORDER BY t5.date_id DESC
LIMIT 0 , 1
Ben mysql ile büyük yüzden herhangi bir yardım mutluluk duyacağız değilim!
Şimdiden teşekkürler!
Bir My SQL Of açıklar:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY,serviceid,userid,productid PRIMARY 4 const 1 Using temporary; Using filesort
1 SIMPLE t5 ALL NULL NULL NULL NULL 20744
1 SIMPLE t3 ALL PRIMARY NULL NULL NULL 4101 Using where; Using join buffer
1 SIMPLE t2 ref fieldid_relid fieldid_relid 8 nextstep_next.t3.id,const 1 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 664 Using where; Using join buffer
Biraz daha bilgi verebilir misiniz: tablolarınızın yapısı, her birinde yaklaşık satır sayısı? – Loufylouf
't1 - kimliği \t kimliği \t orderid \t PackageID \t sunucusu \t regdate - 16000 rows' ' t2 - fieldid relid değeri - 80,000 Rows' 't3 - \t kimliği \t tip \t relid \t AlanAdı \t FIELDTYPE \t açıklama \t fieldoptions \t RegExpr \t adminonly \t gerekli \t ShowOrder \t sortorde \t showinvoice - 5000 't4 rows' - Tam metinler \t \t COURSE_TITLE \t cour course_id se_location \t course_pid \t course_venue \t course_note - 500 rows' 't5 - Tam metinler \t date_id \t date_select \t date_courselocation \t date_coursetitle \t date_coursedisplay - Bu, yardımcı özel tablolarla onun bir WHMCS veritabanı umut @Loufylouf 21.000 rows' –
bir okunabilir biçimi olacaktır Bundan daha iyi. Düzgün girintili bir "CREATE TABLE" gibi, bu da bize sütunlarınızın farklı türlerini ve test için hızlı bir şekilde tablolarınızı oluşturmanın bir yolunu verecektir. Ve böyle bir bilgi gerçekten önemlidir, bu yüzden yorumunuza buradaki soruya eklemek daha iyi olurdu. – Loufylouf