Query time 0.00313
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "4.27"
},
"ordering_operation": {
"using_temporary_table": true,
"using_filesort": true,
"grouping_operation": {
"using_filesort": false,
"nested_loop": [
{
"table": {
"table_name": "companies",
"access_type": "system",
"possible_keys": [
"PRIMARY"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 1,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.00",
"eval_cost": "0.10",
"prefix_cost": "0.00",
"data_read_per_join": "6K"
},
"used_columns": [
"company_id",
"status",
"company"
]
}
},
{
"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": "5K"
},
"used_columns": [
"product_id",
"lang_code",
"company_id",
"product"
]
}
},
{
"table": {
"table_name": "cscart_categories",
"access_type": "const",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id"
],
"key_length": "3",
"ref": [
"const"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 1,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.00",
"eval_cost": "0.10",
"prefix_cost": "0.00",
"data_read_per_join": "4K"
},
"used_columns": [
"category_id",
"usergroup_ids",
"status",
"storefront_id"
]
}
},
{
"table": {
"table_name": "cscart_product_sales",
"access_type": "ref",
"possible_keys": [
"PRIMARY",
"pa"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id"
],
"key_length": "3",
"ref": [
"const"
],
"rows_examined_per_scan": 11,
"rows_produced_per_join": 3,
"filtered": "33.33",
"cost_info": {
"read_cost": "2.32",
"eval_cost": "0.37",
"prefix_cost": "3.42",
"data_read_per_join": "58"
},
"used_columns": [
"category_id",
"product_id",
"amount"
],
"attached_condition": "(`testdobroded`.`cscart_product_sales`.`amount` >= 1)"
}
},
{
"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": [
"const",
"testdobroded.cscart_product_sales.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 3,
"filtered": "100.00",
"using_index": true,
"cost_info": {
"read_cost": "0.00",
"eval_cost": "0.37",
"prefix_cost": "3.78",
"data_read_per_join": "58"
},
"used_columns": [
"product_id",
"category_id"
]
}
},
{
"table": {
"table_name": "products",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"status"
],
"key": "PRIMARY",
"used_key_parts": [
"product_id"
],
"key_length": "3",
"ref": [
"testdobroded.cscart_product_sales.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 0,
"filtered": "5.00",
"cost_info": {
"read_cost": "0.00",
"eval_cost": "0.02",
"prefix_cost": "4.15",
"data_read_per_join": "1K"
},
"used_columns": [
"product_id",
"product_type",
"status",
"company_id",
"usergroup_ids",
"parent_product_id"
],
"attached_condition": "((`testdobroded`.`products`.`company_id` = '1') and ((`testdobroded`.`products`.`usergroup_ids` = '') or (0 <> find_in_set(0,`testdobroded`.`products`.`usergroup_ids`)) or (0 <> find_in_set(1,`testdobroded`.`products`.`usergroup_ids`))) and (`testdobroded`.`products`.`status` = 'A'))"
}
},
{
"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": [
"testdobroded.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.02",
"prefix_cost": "4.17",
"data_read_per_join": "1K"
},
"used_columns": [
"product_id",
"lang_code",
"product"
]
}
},
{
"table": {
"table_name": "prices",
"access_type": "ref",
"possible_keys": [
"usergroup",
"product_id",
"lower_limit",
"usergroup_id"
],
"key": "usergroup",
"used_key_parts": [
"product_id"
],
"key_length": "3",
"ref": [
"testdobroded.cscart_product_sales.product_id"
],
"rows_examined_per_scan": 3,
"rows_produced_per_join": 0,
"filtered": "37.21",
"using_index": true,
"cost_info": {
"read_cost": "0.05",
"eval_cost": "0.02",
"prefix_cost": "4.27",
"data_read_per_join": "4"
},
"used_columns": [
"product_id",
"lower_limit",
"usergroup_id"
],
"attached_condition": "((`testdobroded`.`prices`.`lower_limit` = 1) and (`testdobroded`.`prices`.`usergroup_id` in (0,0,1)))"
}
}
]
}
}
}
}
Result
| product_id |
product |
company_name |
product_ids |
product_types |
parent_product_ids |
product_type |
parent_product_id |
sales_amount |
| 1482 |
Мед-суфле с морошкой 250 г |
ДоброДед |
1482 |
P |
0 |
P |
0 |
16 |
| 1479 |
Мед-суфле с голубикой 250 г |
ДоброДед |
1479 |
P |
0 |
P |
0 |
10 |
| 1476 |
Мед-суфле с клюквой 250 г |
ДоброДед |
1476 |
P |
0 |
P |
0 |
9 |
| 1477 |
Мед-суфле с лесной малиной 250 г |
ДоброДед |
1477 |
P |
0 |
P |
0 |
9 |
| 1478 |
Мед-суфле с земляникой 250 г |
ДоброДед |
1478 |
P |
0 |
P |
0 |
9 |
| 1481 |
Мед-суфле с облепихой 250 г |
ДоброДед |
1481 |
P |
0 |
P |
0 |
9 |
| 1480 |
Мед-суфле с черникой 250 г |
ДоброДед |
1480 |
P |
0 |
P |
0 |
8 |
| 1507 |
Медовый десерт Цветочное разнотравье с хвойной веткой 300 г |
ДоброДед |
1507 |
P |
0 |
P |
0 |
2 |