Hallo Forum,
ich habe eine Datenbank mit 160.000 - 200.000 Artikel, in welcher ich suchen möchte.
Die Abfrage ist mir viel zu langsam.
Wie kann ich diese Beschleunigen?
Durch anderen Index oder...
Hier meine Abfrage:
SELECT A.article_id, A.merchant_id, A.tax_class_id, A.url_pic, A.flg_new, AD.name, AD.description, AP.price, AP.list_price, M.name, AAD.asb_name, AAD.asb_name, AAD.info_url, AAD.logo_url, AAD.alt_text
FROM
ARTICLE AS A
INNER JOIN ARTICLE_DESCRIPTION AS AD ON A.article_id=AD.article_id AND A.merchant_id=AD.merchant_id AND A.shop_id=AD.shop_id
INNER JOIN ARTICLE_PRICE AS AP ON A.article_id=AP.article_id AND A.merchant_id=AP.merchant_id AND A.shop_id=AP.shop_id
INNER JOIN MANUFACTURE AS M ON A.manufacture_id=M.manufacture_id AND A.shop_id=M.shop_id
INNER JOIN ARTICLE_ASB_DESCRIPTION AS AAD ON A.flg_asb=AAD.flg_asb AND A.shop_id=AAD.shop_id
WHERE
A.shop_id=1 AND A.flg_is_active=1 AND AD.name like '%wort%' AND AD.country_code_id=2
AND AP.amount=0 AND AP.customer_group_id=0
ORDER BY A.mass_article, AD.name
In den betreffenden Tabellen habe ich folgende Indexe erstellt:
ARTICLE
-------
PRIMARY KEY (article\_id
,merchant\_id
,shop\_id
),
KEY parent\_article\_id
(parent\_article\_id
),
KEY tax\_class\_id
(tax\_class\_id
),
KEY manufacture\_id
(manufacture\_id
),
KEY article\_number
(article\_number
),
KEY flg\_new
(flg\_new
),
KEY flg\_bargain
(flg\_bargain
),
KEY flg\_is\_active
(flg\_is\_active
),
KEY flg\_asb
(flg\_asb
),
KEY insert\_date
(insert\_date
)
ARTICLE_DESCRIPTION
-------------------
PRIMARY KEY (article\_id
,country\_code\_id
,merchant\_id
,shop\_id
)
MANUFACTURE
-----------
PRIMARY KEY (manufacture\_id
,shop\_id
),
KEY done
(done
),
KEY name
(name
)
ARTICLE_ASB_DESCRIPTION
-----------------------
PRIMARY KEY (flg\_asb
,shop\_id
)
Hat jemand einen Tipp für mich?
Im voraus Danke
Jürgen