将Magento升级到1.13.1后出现问题

时间:2013-12-17 18:35:32

标签: mysql magento

我们几天前将我们的Enterprise升级到1.13.1,以利用新的索引系统,但是一种类型的查询使我们的操作非常慢 - 索引,类别保存和产品保存都触发了这种类型的查询某点:

INSERT IGNORE INTO `catalog_category_product_index_tmp` (`category_id`, `product_id`, `position`, `is_parent`, `store_id`, `visibility`) SELECT `cc`.`entity_id` AS `category_id`, `ccp`.`product_id`, ccp.position + 10000 AS `position`, 0 AS `is_parent`, 1 AS `store_id`, IFNULL(cpvs.value, cpvd.value) AS `visibility` FROM `catalog_category_entity` AS `cc`
INNER JOIN `catalog_category_entity` AS `cc2` ON cc2.path LIKE CONCAT(`cc`.`path`, '/%') AND cc.entity_id NOT IN (1)
INNER JOIN `catalog_category_product` AS `ccp` ON ccp.category_id = cc2.entity_id
INNER JOIN `catalog_product_website` AS `cpw` ON cpw.product_id = ccp.product_id
INNER JOIN `catalog_product_entity_int` AS `cpsd` ON cpsd.entity_id = ccp.product_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 96
LEFT JOIN `catalog_product_entity_int` AS `cpss` ON cpss.entity_id = ccp.product_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
INNER JOIN `catalog_product_entity_int` AS `cpvd` ON cpvd.entity_id = ccp.product_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 102
LEFT JOIN `catalog_product_entity_int` AS `cpvs` ON cpvs.entity_id = ccp.product_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1
INNER JOIN `catalog_category_entity_int` AS `ccad` ON ccad.entity_id = cc.entity_id AND ccad.store_id = 0 AND ccad.attribute_id = 51
LEFT JOIN `catalog_category_entity_int` AS `ccas` ON ccas.entity_id = cc.entity_id AND ccas.attribute_id = ccad.attribute_id AND ccas.store_id = 1 WHERE (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (4, 2)) AND (IFNULL(ccas.value, ccad.value) = 1) AND (`cc`.`entity_id` >= '1') AND (`cc`.`entity_id` < 501) 

这可能需要30分钟才能完成。 它就是那个表或INSERT IGNORE INTO catalog_category_product_cat_tmp

我们有大约80,000个类别,这可能会导致问题,但我们肯定不是世界上唯一拥有这么多的商店。

在MySQL中执行SHOW PROFILE时,它会说它停留在Sending data

有没有人有这方面的经验?是否有我们可以添加到表中的索引来使这个更快捷?有什么方法可以看到查询的哪一部分是实际的瓶颈?

1 个答案:

答案 0 :(得分:1)

没有简单的解决方案 - 最终改写了索引器。