+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | EXPLAIN | +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | { "query_block": { "select_id": 1, "cost": 1637.776452, "nested_loop": [ { "table": { "table_name": "p_shop", "access_type": "ALL", "possible_keys": ["PRIMARY"], "loops": 1, "rows": 23474, "cost": 4.0832992, "filtered": 100, "attached_condition": "p_shop.active = 1 and p_shop.id_shop = 1 and p_shop.visibility in ('both','catalog')" } }, { "table": { "table_name": "p", "access_type": "eq_ref", "possible_keys": ["PRIMARY"], "key": "PRIMARY", "key_length": "4", "used_key_parts": ["id_product"], "ref": ["aaaaa.p_shop.id_product"], "loops": 23474, "rows": 1, "cost": 21.33769096, "filtered": 100 } }, { "table": { "table_name": "pas", "access_type": "ref", "possible_keys": ["id_product"], "key": "id_product", "key_length": "8", "used_key_parts": ["id_product", "id_shop"], "ref": ["aaaaa.p_shop.id_product", "const"], "loops": 23474, "rows": 10, "cost": 253.7509533, "filtered": 100 } }, { "table": { "table_name": "trg", "access_type": "eq_ref", "possible_keys": ["PRIMARY"], "key": "PRIMARY", "key_length": "4", "used_key_parts": ["id_tax_rules_group"], "ref": ["aaaaa.p_shop.id_tax_rules_group"], "loops": 234740, "rows": 1, "cost": 27.75741576, "filtered": 100, "attached_condition": "trigcond(trg.id_tax_rules_group = p_shop.id_tax_rules_group)" } }, { "table": { "table_name": "tr", "access_type": "ref", "possible_keys": ["id_tax_rules_group", "category_getproducts"], "key": "category_getproducts", "key_length": "12", "used_key_parts": ["id_tax_rules_group", "id_country", "id_state"], "ref": ["aaaaa.trg.id_tax_rules_group", "const", "const"], "loops": 234740, "rows": 1, "cost": 427.2659968, "filtered": 100, "attached_condition": "trigcond(tr.zipcode_from = 0 and trigcond(trg.id_tax_rules_group is not null))" } }, { "table": { "table_name": "t", "access_type": "eq_ref", "possible_keys": ["PRIMARY"], "key": "PRIMARY", "key_length": "4", "used_key_parts": ["id_tax"], "ref": ["aaaaa.tr.id_tax"], "loops": 234740, "rows": 1, "cost": 209.9616648, "filtered": 100, "attached_condition": "trigcond(t.id_tax = tr.id_tax and trigcond(tr.id_tax is not null))" } }, { "table": { "table_name": "sp", "access_type": "eq_ref", "possible_keys": ["PRIMARY", "id_product_2", "id_product"], "key": "PRIMARY", "key_length": "4", "used_key_parts": ["id_specific_price"], "ref": ["func"], "loops": 234740, "rows": 1, "cost": 27.77216136, "filtered": 100, "attached_condition": "trigcond(sp.id_product = p_shop.id_product and sp.id_specific_price = (subquery#2))" } }, { "table": { "table_name": "stock_0", "access_type": "ref", "possible_keys": [ "product_sqlstock", "id_product", "id_product_attribute", "quantity" ], "key": "id_product_attribute", "key_length": "4", "used_key_parts": ["id_product_attribute"], "ref": ["func"], "loops": 234740, "rows": 1, "cost": 427.9287296, "filtered": 34.83435059, "index_condition": "stock_0.id_product_attribute = ifnull(pas.id_product_attribute,0)", "attached_condition": "stock_0.id_product = p_shop.id_product and stock_0.quantity > 0" } }, { "table": { "table_name": "cpro_p", "access_type": "ref", "possible_keys": ["PRIMARY", "id_product", "id_category"], "key": "id_product", "key_length": "4", "used_key_parts": ["id_product"], "ref": ["aaaaa.p_shop.id_product"], "loops": 81770.15582, "rows": 2, "cost": 91.64072423, "filtered": 100, "using_index": true } }, { "table": { "table_name": "cshop_p", "access_type": "eq_ref", "possible_keys": ["PRIMARY"], "key": "PRIMARY", "key_length": "8", "used_key_parts": ["id_category", "id_shop"], "ref": ["aaaaa.cpro_p.id_category", "const"], "loops": 163540.3116, "rows": 1, "cost": 146.2778155, "filtered": 100, "attached_condition": "(cshop_p.id_category = 12 or (cshop_p.id_category,cshop_p.id_category in (subquery#3))) and cshop_p.id_category = cpro_p.id_category" } } ], "subqueries": [ { "query_block": { "select_id": 3, "cost": 0.00171364, "nested_loop": [ { "table": { "table_name": "c", "access_type": "range", "possible_keys": ["PRIMARY", "nleftrightactive", "nright"], "key": "nleftrightactive", "key_length": "4", "used_key_parts": ["nleft"], "loops": 1, "rows": 302, "cost": 0.04673591, "filtered": 16.11842155, "attached_condition": "c.nleft >= 3 and c.nright <= 100", "using_index": true } } ] } }, { "expression_cache": { "state": "uninitialized", "query_block": { "select_id": 2, "cost": 0.001792605, "nested_loop": [ { "read_sorted_file": { "filesort": { "sort_key": "spc.from_quantity desc, if(spc.id_group = 3,2,0) + if(spc.id_country = 37,4,0) + if(spc.id_currency = 1,8,0) + if(spc.id_shop = 1,16,0) + if(spc.id_customer = 0,32,0) desc, spc.`to` desc, spc.`from` desc", "table": { "table_name": "spc", "access_type": "ref", "possible_keys": [ "id_product_2", "id_product", "id_product_attribute", "id_shop", "from", "to" ], "key": "id_product_2", "key_length": "8", "used_key_parts": ["id_product", "id_product_attribute"], "ref": ["aaaaa.p.id_product", "const"], "loops": 1, "rows": 1, "cost": 0.001792605, "filtered": 99.92241669, "attached_condition": "spc.id_product <=> p.id_product and spc.id_product_attribute <=> 0 and spc.id_shop in (0,1) and spc.id_currency in (0,1) and spc.id_country in (0,37) and spc.id_group in (0,3) and (spc.`from` = TIMESTAMP'0000-00-00 00:00:00' or '2022-05-31 23:12:00' >= spc.`from`) and (spc.`to` = TIMESTAMP'0000-00-00 00:00:00' or '2022-05-31 23:12:00' <= spc.`to`)", "using_index": true } } } } ] } } } ] } } | +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set, 1 warning (0.017 sec)