Showing results for 
Search instead for 
Did you mean: 

Huge slow query for products, categories, filters

Huge slow query for products, categories, filters

I run a Magento 1.9 based store with around 40 thousand active products. Using an FPC I am able to keep the server stable sometimes, and other unstable. While checking for highest hardware consumption I found the following query with thousands of numbers related to product IDs inside the query where I wrote ...

Have you been through this problem and came to a solution ? Do you have any ideas on how to solve it ?


SELECT `e`.*, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, 
IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), 
price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `cat_index`.`position` AS `cat_index_position` FROM `catalog_product_entity` AS `e`

 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id 
 AND price_index.website_id = '1' AND price_index.customer_group_id = 0

 INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id 
 AND cat_index.store_id='1' AND cat_index.visibility IN(3, 4) AND cat_index.category_id = '2' 
 WHERE (`e`.`entity_id` IN(36873, 43340, 43334, 43318, ...))

 ORDER BY FIELD(`e`.`entity_id`, 36873, 43340, 43334, ...)) ASC LIMIT 7