BlackPMetall
Grünschnabel
Hallo
,
ich arbeite gerade an eine Filterfunktion bei einem Online Shop. Dabei wird abhängig vom Auswahl eine virtuelle Tabelle mit JOIN zwischen mehrere Tabellen erstellt.
Es funktioniert alles soweit. Problem ist nur wenn zwei bestimmte Tabellen mit einander kombiniert werden, die MySql Anfrage sehr langsam läuft.
Wenn alle Filterfunktionen ausgewählt wurden, dann sieht die maximale Anfrage so aus:
select
p.products_image, p.products_image_lrg, pd.products_name, p.teppichnr, p.products_quantity, p.long, p.width, pricehoch, p.products_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price
from
products p
left join products_description pd on pd.products_id = p.products_id
left join specials s on s.products_id = p.products_id
left join products_to_categories p2c on p2c.products_id = p.products_id
join teppichfarbe tep on tep.teppichnr = p.products_id
join teppichform tef on tef.teppnr = p.products_id
where
p.products_status = '1' and p.long < '566' and p.width < '372' and ( tep.farbe = 'Rot' ) and ( tef.form = '0' ) and pd.language_id = '2' AND p.products_price < '19530.5'
group by p.products_id order by `so`
DESC , p.products_id DESC
Problem Tabellen sind: teppichfarbe und teppichform. Wenn diese beide miteinander in der Anfrage drin sind ist die Anfrage sehr langsam. Die Tabellen haben zurzeit um 10000 Einträge.
Struktur diese beide Tabellen sind wie folgt:
`teppichfarbe` (
`teppichnr` int(10) NOT NULL,
`farbe` varchar(15) NOT NULL
)
`teppichform` (
`teppnr` int(10) NOT NULL,
`form` int(10) NOT NULL
)
Kann mir jemand weiter helfen?
Vielen Dank in Voraus.

ich arbeite gerade an eine Filterfunktion bei einem Online Shop. Dabei wird abhängig vom Auswahl eine virtuelle Tabelle mit JOIN zwischen mehrere Tabellen erstellt.
Es funktioniert alles soweit. Problem ist nur wenn zwei bestimmte Tabellen mit einander kombiniert werden, die MySql Anfrage sehr langsam läuft.
Wenn alle Filterfunktionen ausgewählt wurden, dann sieht die maximale Anfrage so aus:
select
p.products_image, p.products_image_lrg, pd.products_name, p.teppichnr, p.products_quantity, p.long, p.width, pricehoch, p.products_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price
from
products p
left join products_description pd on pd.products_id = p.products_id
left join specials s on s.products_id = p.products_id
left join products_to_categories p2c on p2c.products_id = p.products_id
join teppichfarbe tep on tep.teppichnr = p.products_id
join teppichform tef on tef.teppnr = p.products_id
where
p.products_status = '1' and p.long < '566' and p.width < '372' and ( tep.farbe = 'Rot' ) and ( tef.form = '0' ) and pd.language_id = '2' AND p.products_price < '19530.5'
group by p.products_id order by `so`
DESC , p.products_id DESC
Problem Tabellen sind: teppichfarbe und teppichform. Wenn diese beide miteinander in der Anfrage drin sind ist die Anfrage sehr langsam. Die Tabellen haben zurzeit um 10000 Einträge.
Struktur diese beide Tabellen sind wie folgt:
`teppichfarbe` (
`teppichnr` int(10) NOT NULL,
`farbe` varchar(15) NOT NULL
)
`teppichform` (
`teppnr` int(10) NOT NULL,
`form` int(10) NOT NULL
)
Kann mir jemand weiter helfen?
Vielen Dank in Voraus.