0

我们的 Magento 商店中有大约 8k 种产品。以下查询每 5 分钟开始一次,似乎没有结束。我检查了流程图,发现这个查询运行了很多次。当 MySQL 达到其允许的连接(允许 200 个并发连接)时,它就崩溃了。这种情况每小时都会发生,我们必须重新启动 MySQL 服务器。

我用谷歌搜索并没有得到任何解决方案。

SELECT`e`.* , IF( at_status.value_id >0, at_status.value, at_status_default.value )AS`status` , IF( at_visibility.value_id >0, at_visibility.value, at_visibility_default.value )AS`visibility` ,`at_price`.`value`AS`price` ,`stock`.`qty` ,`stock`.`is_in_stock` ,`stock`.`manage_stock` ,`stock`.`use_config_manage_stock` ,`url`.`request_path` ,`categories`.* , GROUP_CONCAT( categories_index.category_id )AS`categories_ids` ,`price_index`.`min_price` ,`price_index`.`max_price` ,`price_index`.`tier_price` ,`price_index`.`final_price` 
FROM`catalog_product_entity`AS`e` 
INNERJOIN`catalog_product_website`AS`product_website`ON product_website.product_id = e.entity_id
AND product_website.website_id =\'2\'
INNERJOIN`catalog_product_entity_int`AS`at_status_default`ON (`at_status_default`.`entity_id`=`e`.`entity_id`) 
AND (
 `at_status_default`.`attribute_id`=\'87\'
)
AND`at_status_default`.`store_id`=0
LEFTJOIN`catalog_product_entity_int`AS`at_status`ON (`at_status`.`entity_id`=`e`.`entity_id`) 
AND (
 `at_status`.`attribute_id`=\'87\'
)
AND (
 `at_status`.`store_id`=2
)
INNERJOIN`catalog_product_entity_int`AS`at_visibility_default`ON (`at_visibility_default`.`entity_id`=`e`.`entity_id`) 
AND (
 `at_visibility_default`.`attribute_id`=\'93\'
)
AND`at_visibility_default`.`store_id`=0
LEFTJOIN`catalog_product_entity_int`AS`at_visibility`ON (`at_visibility`.`entity_id`=`e`.`entity_id`) 
AND (
 `at_visibility`.`attribute_id`=\'93\'
)
AND (
 `at_visibility`.`store_id`=2
)
INNERJOIN`catalog_product_entity_decimal`AS`at_price`ON (`at_price`.`entity_id`=`e`.`entity_id`) 
AND (
 `at_price`.`attribute_id`=\'67\'
)
AND (
 `at_price`.`store_id`=0
)
LEFTJOIN`cataloginventory_stock_item`AS`stock`ON stock.product_id = e.entity_id
LEFTJOIN`core_url_rewrite`AS`url`ON url.product_id = e.entity_id
AND url.category_id ISNULL 
AND is_system =1
AND ISNULL( options ) 
AND url.store_id =2
LEFTJOIN`catalog_category_product`AS`categories`ON categories.product_id = e.entity_id
INNERJOIN`catalog_category_product_index`AS`categories_index`ON categories_index.category_id = categories.category_id
AND categories_index.product_id = categories.product_id
AND categories_index.store_id =2
AND categories_index.category_id
IN ( 3, 298, 299, 300, 301, 302, 306, 462, 463, 464, 465, 466, 467, 468, 469, 470, 303, 434, 435, 436, 441, 442, 443, 444, 445, 446, 304, 305, 480, 481, 482, 307, 309, 310, 311, 474, 313, 447, 448, 449, 418, 312, 419, 479, 314, 405, 406, 407, 408, 409, 315, 428, 438, 316, 415, 416, 417, 317, 402, 403, 404, 384, 385, 387, 388, 389, 390, 391, 430, 437, 439, 440, 308, 378, 379, 380, 381, 382, 458, 459, 383, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 450, 451, 497, 452, 454, 455, 456, 457, 460, 461, 318, 319, 420, 421, 422, 423, 320, 424, 425, 426, 427, 321, 322, 323, 364, 365, 366, 367, 473, 487, 488, 489, 490, 491, 492, 483, 484, 485, 486, 324, 325, 369, 370, 326, 453, 327, 328, 371, 372, 329, 376, 377, 330, 373, 374, 331, 332, 333, 334, 471, 335, 375, 337, 338, 336, 431, 432, 433, 339, 340, 341, 496, 342, 343, 344, 345, 346, 347, 348, 493, 495, 498, 499, 500, 502, 503, 349, 350, 351, 494, 501, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 410, 411, 412, 413, 414, 368, 475, 477, 478) 
LEFTJOIN`catalog_product_index_price`AS`price_index`ON price_index.entity_id = e.entity_id
AND customer_group_id =0
AND price_index.website_id =2
WHERE (
IF( at_status.value_id >0, at_status.value, at_status_default.value )=\'1\'
)
AND (
 `e`.`type_id` 
IN (
 \'simple\',\'configurable\',\'bundle\',\'grouped\',\'virtual\',\'downloadable\'
))
AND (
IF( at_visibility.value_id >0, at_visibility.value, at_visibility_default.value ) 
IN (
 \'2\',\'3\',\'4\'
))
AND (
at_price.value >\'0\'
)
AND (
(
is_in_stock !=\'0\'
OR (
manage_stock !=\'1\'
AND use_config_manage_stock !=\'1\'
)
OR (
use_config_manage_stock !=\'0\'
AND 1=0
AND is_in_stock =0
)))
GROUPBY`e`.`entity_id` , `e`.`entity_id` 
LIMIT 1500
4

0 回答 0