mixmastertobsi: MySQL Explain Speed Problem

Beitrag lesen

Hallo,

ich habe folgende Abfrage und finde hier leider keine Lösung, die SQL ABfrage zu beschleunigen. Kurz - ich habe eine Produktsuche und diese gibt dann die Artikelnummern zurück. Über die Artikelnummern mache ich dann weitere SQL Abfragen und je nach Suche, kommen da schon einige Artikelnummern in den "IN" Operator zusammen.

Was mich wundert, ist das "Materialized" im Explain - was ist das?

Wie bekomme ich die Rows "1231" auf einen niedrigeren wert?

Gibt es ggf. eine schnellere Variante, um die Artikelnummern zu laden?

SELECT COUNT(distinct artikel.anr) as anzahl, artikel_attribut_value.value  
FROM artikel 
JOIN artikel_attribut ON artikel_attribut.anr=artikel.anr
JOIN artikel_attribut_name ON artikel_attribut_name.anr=artikel.anr AND artikel_attribut_name.attribut='größe'
JOIN artikel_attribut_value ON artikel_attribut_value.attribut=artikel_attribut_name.attributnr AND artikel_attribut_value.atrnr=artikel_attribut.atrnr 

WHERE (artikel.available IS TRUE) AND (artikel.anr IN (100000762,100000772......))
GROUP BY artikel_attribut_value.value
HAVING COUNT(distinct artikel.anr)>3
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY ALL distinct_key 1231 Using temporary; Using filesort
1 PRIMARY artikel eq_ref PRIMARY PRIMARY 4 tvc_0._col_1 1 Using where
1 PRIMARY artikel_attribut_name ref index_anr_value,index_attribut,index_anr_attribut,index_anr,index_attribut_anr index_anr_value 13 tvc_0._col_1,const 1 Using index condition; Using where
1 PRIMARY artikel_attribut ref PRIMARY,index_anr,index_anr_available_preis,index_anr_lieferzeit,index_anr_preis_available,index_anr_preis,index_atrnr index_anr 4 slewo_live.artikel.anr 4 Using index
1 PRIMARY artikel_attribut_value ref UNIQUE,index_atrnr_attribut,index_atrnr,index_atrnr_attribut_value UNIQUE 9 slewo_live.artikel_attribut.atrnr,slewo_live.artikel_attribut_name.attributnr 1 Using index condition
2 MATERIALIZED ALL 1231
3 DERIVED No tables used

(Edit: Tabellendaten als Tabelle formatiert)