Hallo,
ich habe zwei Suchabfragen, die die passende Produkte im Shop ausgeben.
Beide SQL-Befehle sind ähnlich, allerdings benötigt die eine Suche ca. 10 sek., hingegen die andere nicht einmal 1 sek. (in php-MyAdmin getestet)
Meine Frage ist:
Kann es sein, dass eine Suche so lange dauert? Es werden nur 10 Produkte durchsucht!?
Wenn ja, wie kann ich im Shop den Hinweis einbetten, dass der Nutzer um einen Moment Geduld gebeten wird.
Wahrscheinlich kann die SQL-Abfrage optimiert werden!!?
Hier die SQL-Abfrage, die so lange dauert:
SELECT distinct
Unterabfrage.*,
p.products_id,
p.products_price,
p.products_model,
p.products_quantity,
p.products_shippingtime,
p.products_fsk18,
p.products_image,
p.products_weight,
p.products_tax_class_id,
pd.products_name,
pd.products_short_description,
pd.products_description
FROM (
SELECT products_gewinde.products_id
FROM products_gewinde, products_modelle_gewinde, products AS p , products_description AS pd
WHERE products_gewinde.AA >= '200'
AND products_gewinde.BB >= '200'
AND products_gewinde.ZMIN <='47'
AND products_gewinde.ZMAX >='47'
) as Unterabfrage
INNER JOIN products AS p
ON Unterabfrage.products_id=p.products_id
LEFT JOIN products_description AS pd ON (p.products_id = pd.products_id)
WHERE p.products_status = '1' AND pd.language_id = '2'
Vielen Dank für Hinweise.
Ines Hoppe