mysql - Magento bundle 产品 SQLSTATE[HY000] : General error: 2006 MySQL server has gone away

标签 mysql magento bundle

当我修改属于 bundle 的 Magento 1.7.0.2 简单产品时,有时会出现错误:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away.

在 mysql.slowquery.log 中出现了这个可怕的查询:

Query_time: 30.408723  Lock_time: 0.000463 Rows_sent: 0  Rows_examined: 128
SET timestamp=1353399962;

INSERT INTO `catalog_product_index_price_bundle_tmp` SELECT `e`.`entity_id`, `cg`.`customer_group_id`, `cw`.`website_id`, 0 AS `tax_class_id`, 0 AS `price_type`, IF(IF(IF(IFNULL(tas_special_from_date.value_id, -1) > 0, tas_special_from_date.value, tad_special_from_date.value) IS NULL, 1, IF(IF(IFNULL(tas_special_from_date.value_id, -1) > 0, tas_special_from_date.value, tad_special_from_date.value) <= cwd.website_date, 1, 0)) > 0 AND IF(IF(IFNULL(tas_special_to_date.value_id, -1) > 0, tas_special_to_date.value, tad_special_to_date.value) IS NULL, 1, IF(IF(IFNULL(tas_special_to_date.value_id, -1) > 0, tas_special_to_date.value, tad_special_to_date.value) >= cwd.website_date, 1, 0)) > 0 AND ta_special_price.value > 0 AND ta_special_price.value < 100 , ta_special_price.value, 0) AS `special_price`, tp.min_price AS `tier_percent`, IF(ta_price.value IS NULL, 0, ta_price.value) AS `orig_price`, 0 AS `price`, 0 AS `min_price`, 0 AS `max_price`, IF(tp.min_price IS NOT NULL, 0, NULL) AS `tier_price`, IF(tp.min_price IS NOT NULL, 0, NULL) AS `base_tier`, IF(IF(gp.price IS NOT NULL AND gp.price > 0 AND gp.price < 100, gp.price, 0) > 0, IF(gp.price IS NOT NULL AND gp.price > 0 AND gp.price < 100, gp.price, 0), NULL) AS `group_price`, IF(IF(gp.price IS NOT NULL AND gp.price > 0 AND gp.price < 100, gp.price, 0) > 0, IF(gp.price IS NOT NULL AND gp.price > 0 AND gp.price < 100, gp.price, 0), NULL) AS `base_group_price`, gp.price AS `group_price_percent` FROM `catalog_product_entity` AS `e`
 CROSS JOIN `customer_group` AS `cg`
 CROSS JOIN `core_website` AS `cw`
 INNER JOIN `core_store_group` AS `csg` ON csg.group_id = cw.default_group_id
 INNER JOIN `core_store` AS `cs` ON cs.store_id = csg.default_store_id
 INNER JOIN `catalog_product_website` AS `pw` ON pw.product_id = e.entity_id AND pw.website_id = cw.website_id
 INNER JOIN `catalog_product_index_website` AS `cwd` ON cw.website_id = cwd.website_id
 LEFT JOIN `catalog_product_index_tier_price` AS `tp` ON tp.entity_id = e.entity_id AND tp.website_id = cw.website_id AND tp.customer_group_id = cg.customer_group_id
 LEFT JOIN `catalog_product_index_group_price` AS `gp` ON gp.entity_id = e.entity_id AND gp.website_id = cw.website_id AND gp.customer_group_id = cg.customer_group_id
 INNER JOIN `catalog_product_entity_int` AS `tad_status` ON tad_status.entity_id = e.entity_id AND tad_status.attribute_id = 89 AND tad_status.store_id = 0
 LEFT JOIN `catalog_product_entity_int` AS `tas_status` ON tas_status.entity_id = e.entity_id AND tas_status.attribute_id = 89 AND tas_status.store_id = cs.store_id
 LEFT JOIN `catalog_product_entity_int` AS `tad_tax_class_id` ON tad_tax_class_id.entity_id = e.entity_id AND tad_tax_class_id.attribute_id = 115 AND tad_tax_class_id.store_id = 0
 LEFT JOIN `catalog_product_entity_int` AS `tas_tax_class_id` ON tas_tax_class_id.entity_id = e.entity_id AND tas_tax_class_id.attribute_id = 115 AND tas_tax_class_id.store_id = cs.store_id
 INNER JOIN `catalog_product_entity_int` AS `ta_price_type` ON ta_price_type.entity_id = e.entity_id AND ta_price_type.attribute_id = 117 AND ta_price_type.store_id = 0
 LEFT JOIN `catalog_product_entity_decimal` AS `ta_price` ON ta_price.entity_id = e.entity_id AND ta_price.attribute_id = 69 AND ta_price.store_id = 0
 LEFT JOIN `catalog_product_entity_decimal` AS `ta_special_price` ON ta_special_price.entity_id = e.entity_id AND ta_special_price.attribute_id = 70 AND ta_special_price.store_id = 0
 LEFT JOIN `catalog_product_entity_datetime` AS `tad_special_from_date` ON tad_special_from_date.entity_id = e.entity_id AND tad_special_from_date.attribute_id = 71 AND tad_special_from_date.store_id = 0
 LEFT JOIN `catalog_product_entity_datetime` AS `tas_special_from_date` ON tas_special_from_date.entity_id = e.entity_id AND tas_special_from_date.attribute_id = 71 AND tas_special_from_date.store_id = cs.store_id
 LEFT JOIN `catalog_product_entity_datetime` AS `tad_special_to_date` ON tad_special_to_date.entity_id = e.entity_id AND tad_special_to_date.attribute_id = 72 AND tad_special_to_date.store_id = 0
 LEFT JOIN `catalog_product_entity_datetime` AS `tas_special_to_date` ON tas_special_to_date.entity_id = e.entity_id AND tas_special_to_date.attribute_id = 72 AND tas_special_to_date.store_id = cs.store_id WHERE (e.type_id='bundle') AND (IF(IFNULL(tas_status.value_id, -1) > 0, tas_status.value, tad_status.value)=1) AND (ta_price_type.value=0) AND (e.entity_id IN(2399, 2400, 2401, 2402)) ON DUPLICATE KEY UPDATE `tax_class_id` = VALUES(`tax_class_id`), `price_type` = VALUES(`price_type`), `special_price` = VALUES(`special_price`), `tier_percent` = VALUES(`tier_percent`), `orig_price` = VALUES(`orig_price`), `price` = VALUES(`price`), `min_price` = VALUES(`min_price`), `max_price` = VALUES(`max_price`), `tier_price` = VALUES(`tier_price`), `base_tier` = VALUES(`base_tier`), `group_price` = VALUES(`group_price`), `base_group_price` = VALUES(`base_group_price`), `group_price_percent` = VALUES(`group_price_percent`);

在数据库中,表 catalog_product_index_price_bundle_tmp 是空的。

谢谢。

最佳答案

我遇到了同样的问题。 尝试将此行添加到 my.cnf:

optimizer_search_depth = 5

MySQL Doc - Controlling the Query Optimizer

关于mysql - Magento bundle 产品 SQLSTATE[HY000] : General error: 2006 MySQL server has gone away,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13471458/

相关文章:

mysql - 我们可以通过连接器在 PrestoDB 中使用 mysql 和 cassandra 吗?

mysql - Django 日期时间字段自动添加 7 小时

magento - 应用于special_price 的目录价格规则

jsf - OSGI 和 JSF 如何协同工作?

php - 如何在将Excel导入mysql时修剪前导空格

c# - 如何更改 Visual Studio 中 Asp Mvc 中的默认注册和登录以使用 MySql?

magento - 模块和ajax调用

jquery - 自定义添加的顶级菜单项的事件状态 [Magento topmenu]

Angular 8 加载应用程序 Assets 两次

ios - 在 iOS 中创建自定义框架