Query time 0.00101
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "91.03"
},
"grouping_operation": {
"using_filesort": false,
"nested_loop": [
{
"table": {
"table_name": "cscart_products_categories",
"access_type": "range",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "pt",
"used_key_parts": [
"product_id"
],
"key_length": "3",
"rows_examined_per_scan": 104,
"rows_produced_per_join": 104,
"filtered": "100.00",
"index_condition": "(`dbggbern`.`cscart_products_categories`.`product_id` in (5695,5696,5694,5691,7258,7257,7259,7260,7261,7256,6714,6713,6715,6693,6712,6711,1458,1462,1460,1461,1459,1463,7733,4242))",
"cost_info": {
"read_cost": "42.41",
"eval_cost": "10.40",
"prefix_cost": "52.81",
"data_read_per_join": "1K"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
},
{
"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": [
"dbggbern.cscart_products_categories.category_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 5,
"filtered": "5.00",
"cost_info": {
"read_cost": "26.00",
"eval_cost": "0.52",
"prefix_cost": "89.21",
"data_read_per_join": "20K"
},
"used_columns": [
"category_id",
"usergroup_ids",
"status",
"storefront_id"
],
"attached_condition": "((`dbggbern`.`cscart_categories`.`storefront_id` in (0,1)) and ((`dbggbern`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`dbggbern`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`dbggbern`.`cscart_categories`.`usergroup_ids`))) and (`dbggbern`.`cscart_categories`.`status` in ('A','H')))"
}
},
{
"table": {
"table_name": "product_position_source",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id",
"product_id"
],
"key_length": "6",
"ref": [
"const",
"dbggbern.cscart_products_categories.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 5,
"filtered": "100.00",
"cost_info": {
"read_cost": "1.30",
"eval_cost": "0.52",
"prefix_cost": "91.03",
"data_read_per_join": "83"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 1458 |
16,24,7M |
0 |
| 1459 |
16,7,24M |
0 |
| 1460 |
24,16,7M |
0 |
| 1461 |
16,24,7M |
0 |
| 1462 |
24,16,7M |
0 |
| 1463 |
16,24,7M |
0 |
| 4242 |
39,7M |
0 |
| 5691 |
24,49,501,16,1,7M |
0 |
| 5694 |
24,49,501,16,1,7M |
0 |
| 5695 |
24,49,501,16,1,7M |
0 |
| 5696 |
24,49,501,16,1,7M |
0 |
| 6693 |
16,7,584,1M |
0 |
| 6711 |
24,16,7,584,1M |
0 |
| 6712 |
7,584,16,24,1M |
0 |
| 6713 |
7,584,16,24,1M |
0 |
| 6714 |
584,24,7,16,1M |
0 |
| 6715 |
16,584,24,7,1M |
0 |
| 7256 |
7,16,585,24M |
0 |
| 7257 |
7,16,585,24M |
0 |
| 7258 |
7,16,585,24M |
0 |
| 7259 |
7,16,585,24M |
0 |
| 7260 |
7,16,585,24M |
0 |
| 7261 |
7,16,585,24M |
0 |
| 7733 |
24,16,7M |
0 |