Query time 0.01530
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "72.41"
},
"ordering_operation": {
"using_filesort": true,
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"buffer_result": {
"using_temporary_table": true,
"nested_loop": [
{
"table": {
"table_name": "shared_descr",
"access_type": "system",
"possible_keys": [
"PRIMARY",
"product_id",
"company_id"
],
"rows_examined_per_scan": 0,
"rows_produced_per_join": 1,
"filtered": "0.00",
"const_row_not_found": true,
"cost_info": {
"read_cost": "0.00",
"eval_cost": "0.10",
"prefix_cost": "0.00",
"data_read_per_join": "4K"
},
"used_columns": [
"product_id",
"lang_code",
"company_id",
"product"
]
}
},
{
"table": {
"table_name": "companies",
"access_type": "range",
"possible_keys": [
"PRIMARY"
],
"key": "PRIMARY",
"used_key_parts": [
"company_id"
],
"key_length": "4",
"rows_examined_per_scan": 2,
"rows_produced_per_join": 1,
"filtered": "50.00",
"index_condition": "(`test_uchur_k`.`companies`.`company_id` <> 2)",
"cost_info": {
"read_cost": "1.31",
"eval_cost": "0.10",
"prefix_cost": "1.41",
"data_read_per_join": "6K"
},
"used_columns": [
"company_id",
"status",
"company"
],
"attached_condition": "(`test_uchur_k`.`companies`.`status` = 'A')"
}
},
{
"table": {
"table_name": "cscart_product_sales",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"pa"
],
"rows_examined_per_scan": 460,
"rows_produced_per_join": 153,
"filtered": "33.33",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "31.54",
"eval_cost": "15.33",
"prefix_cost": "48.28",
"data_read_per_join": "2K"
},
"used_columns": [
"category_id",
"product_id",
"amount"
],
"attached_condition": "(`test_uchur_k`.`cscart_product_sales`.`amount` >= 1)"
}
},
{
"table": {
"table_name": "cscart_categories",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id"
],
"key_length": "3",
"ref": [
"test_uchur_k.cscart_product_sales.category_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 7,
"filtered": "5.00",
"cost_info": {
"read_cost": "0.00",
"eval_cost": "0.77",
"prefix_cost": "63.62",
"data_read_per_join": "40K"
},
"used_columns": [
"category_id",
"storefront_id",
"usergroup_ids",
"status"
],
"attached_condition": "(((`test_uchur_k`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`test_uchur_k`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`test_uchur_k`.`cscart_categories`.`usergroup_ids`))) and (`test_uchur_k`.`cscart_categories`.`status` in ('A','H')) and (`test_uchur_k`.`cscart_categories`.`storefront_id` in (0,1)))"
}
},
{
"table": {
"table_name": "products",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"status"
],
"key": "PRIMARY",
"used_key_parts": [
"product_id"
],
"key_length": "3",
"ref": [
"test_uchur_k.cscart_product_sales.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 0,
"filtered": "8.92",
"cost_info": {
"read_cost": "0.00",
"eval_cost": "0.07",
"prefix_cost": "64.38",
"data_read_per_join": "7K"
},
"used_columns": [
"product_id",
"product_type",
"status",
"company_id",
"amount",
"usergroup_ids",
"tracking",
"parent_product_id",
"is_stock_split_by_warehouses"
],
"attached_condition": "((`test_uchur_k`.`products`.`company_id` = `test_uchur_k`.`companies`.`company_id`) and ((`test_uchur_k`.`products`.`usergroup_ids` = '') or (0 <> find_in_set(0,`test_uchur_k`.`products`.`usergroup_ids`)) or (0 <> find_in_set(1,`test_uchur_k`.`products`.`usergroup_ids`))) and (`test_uchur_k`.`products`.`status` = 'A'))"
}
},
{
"table": {
"table_name": "products_categories",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id",
"product_id"
],
"key_length": "6",
"ref": [
"test_uchur_k.cscart_product_sales.category_id",
"test_uchur_k.cscart_product_sales.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 0,
"filtered": "100.00",
"using_index": true,
"cost_info": {
"read_cost": "0.00",
"eval_cost": "0.07",
"prefix_cost": "64.45",
"data_read_per_join": "10"
},
"used_columns": [
"product_id",
"category_id"
]
}
},
{
"table": {
"table_name": "descr1",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"product_id"
],
"key": "PRIMARY",
"used_key_parts": [
"product_id",
"lang_code"
],
"key_length": "9",
"ref": [
"test_uchur_k.cscart_product_sales.product_id",
"const"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 0,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.00",
"eval_cost": "0.07",
"prefix_cost": "64.52",
"data_read_per_join": "3K"
},
"used_columns": [
"product_id",
"lang_code",
"product"
]
}
},
{
"table": {
"table_name": "prices",
"access_type": "ref",
"possible_keys": [
"usergroup",
"product_id",
"lower_limit",
"usergroup_id"
],
"key": "product_id",
"used_key_parts": [
"product_id"
],
"key_length": "3",
"ref": [
"test_uchur_k.cscart_product_sales.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 0,
"filtered": "75.77",
"cost_info": {
"read_cost": "0.17",
"eval_cost": "0.05",
"prefix_cost": "64.76",
"data_read_per_join": "12"
},
"used_columns": [
"product_id",
"lower_limit",
"usergroup_id"
],
"attached_condition": "((`test_uchur_k`.`prices`.`lower_limit` = 1) and (`test_uchur_k`.`prices`.`usergroup_id` in (0,0,1)))"
}
},
{
"table": {
"table_name": "img_links",
"access_type": "ref",
"possible_keys": [
"PRIMARY",
"object_id"
],
"key": "object_id",
"used_key_parts": [
"object_id",
"object_type",
"type"
],
"key_length": "81",
"ref": [
"test_uchur_k.cscart_product_sales.product_id",
"const",
"const"
],
"rows_examined_per_scan": 4,
"rows_produced_per_join": 2,
"filtered": "100.00",
"index_condition": "(`test_uchur_k`.`img_links`.`object_id` = `test_uchur_k`.`cscart_product_sales`.`product_id`)",
"cost_info": {
"read_cost": "0.52",
"eval_cost": "0.21",
"prefix_cost": "65.48",
"data_read_per_join": "198"
},
"used_columns": [
"pair_id",
"object_id",
"object_type",
"type"
],
"attached_condition": "(`test_uchur_k`.`img_links`.`pair_id` > 0)"
}
},
{
"table": {
"table_name": "war_sum_amount",
"access_type": "ref",
"possible_keys": [
"PRIMARY"
],
"key": "PRIMARY",
"used_key_parts": [
"product_id"
],
"key_length": "3",
"ref": [
"test_uchur_k.cscart_product_sales.product_id"
],
"rows_examined_per_scan": 15,
"rows_produced_per_join": 31,
"filtered": "100.00",
"using_index": true,
"cost_info": {
"read_cost": "0.71",
"eval_cost": "3.11",
"prefix_cost": "69.31",
"data_read_per_join": "497"
},
"used_columns": [
"product_id"
]
}
},
{
"table": {
"table_name": "warehouses_destination_products_amount",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"idx_storefront_id"
],
"key": "PRIMARY",
"used_key_parts": [
"product_id",
"destination_id",
"storefront_id"
],
"key_length": "9",
"ref": [
"test_uchur_k.cscart_product_sales.product_id",
"const",
"const"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 31,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.00",
"eval_cost": "3.11",
"prefix_cost": "72.41",
"data_read_per_join": "497"
},
"used_columns": [
"destination_id",
"storefront_id",
"product_id",
"amount"
],
"attached_condition": "<if>(found_match(warehouses_destination_products_amount), (((case `test_uchur_k`.`products`.`is_stock_split_by_warehouses` when 'Y' then `test_uchur_k`.`warehouses_destination_products_amount`.`amount` else `test_uchur_k`.`products`.`amount` end) > 0) or (`test_uchur_k`.`products`.`tracking` = 'D')), true)"
}
}
]
}
}
}
}
}
Result
| product_id |
product |
company_name |
product_ids |
product_types |
parent_product_ids |
product_type |
parent_product_id |
sales_amount |
| 132 |
Кружка туристическая UCHUR PEAK цв. Белый |
UCHUR(Астана) |
132,132,132,132,132,132 |
P,P,P,P,P,P |
0,0,0,0,0,0 |
P |
0 |
30 |
| 2 |
Термокружка UCHUR Ceramic Thermo цв. Черный 500ml с кожаной вставкой |
UCHUR(Астана) |
2,2,2,2,2,2 |
P,P,P,P,P,P |
0,0,0,0,0,0 |
P |
0 |
12 |
| 3 |
Термокружка UCHUR Итии цв. Черный 580ml |
UCHUR(Астана) |
3,3,3,3,3,3 |
P,P,P,P,P,P |
0,0,0,0,0,0 |
P |
0 |
12 |
| 4 |
Кепка UCHUR ROUND PATCH цв. Черный (с сеткой) |
UCHUR(Астана) |
4,4,4,4,4,4 |
P,P,P,P,P,P |
0,0,0,0,0,0 |
P |
0 |
12 |
| 8 |
Футболка UCHUR BEAR BLACK T-SHIRT |
UCHUR(Астана) |
8,8,8,8,8,8,8,8 |
P,P,P,P,P,P,P,P |
0,0,0,0,0,0,0,0 |
P |
0 |
8 |
| 11 |
Шапка UCHUR BEANIE цв. BLACK |
UCHUR(Астана) |
11,11,11,11,11,11,11,11 |
P,P,P,P,P,P,P,P |
0,0,0,0,0,0,0,0 |
P |
0 |
8 |
| 12 |
Футболка UCHUR MOUNTAIN SHEEP OLIVE T-SHIRT |
UCHUR(Астана) |
12,12,12,12,12,12,12,12 |
P,P,P,P,P,P,P,P |
0,0,0,0,0,0,0,0 |
P |
0 |
8 |
| 30 |
Термобелье UCHUR Men's Thermal Underwear цв. SAAS |
UCHUR(Астана) |
30,30,30,30,30,30,30,30 |
P,P,P,P,P,P,P,P |
0,0,0,0,0,0,0,0 |
P |
0 |
8 |
| 31 |
Термобелье UCHUR Men's Thermal Underwear цв. TAAS |
UCHUR(Астана) |
31,31,31,31,31,31,31,31 |
P,P,P,P,P,P,P,P |
0,0,0,0,0,0,0,0 |
P |
0 |
8 |
| 46 |
Термобелье UCHUR Arctic Thermo Pro цв. Черный |
UCHUR(Астана) |
46,46,46,46,46,46,46,46 |
P,P,P,P,P,P,P,P |
0,0,0,0,0,0,0,0 |
P |
0 |
8 |
| 56 |
Шапка UCHUR TRAVELER цв. BLACK |
UCHUR(Астана) |
56,56,56,56,56,56,56,56 |
P,P,P,P,P,P,P,P |
0,0,0,0,0,0,0,0 |
P |
0 |
8 |
| 81 |
Шапка UCHUR HUNTER цв. TAAS |
UCHUR(Астана) |
81,81,81,81,81,81,81,81 |
P,P,P,P,P,P,P,P |
0,0,0,0,0,0,0,0 |
P |
0 |
8 |