Query time 0.00197
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "60.02"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "0.92"
},
"nested_loop": [
{
"table": {
"table_name": "cscart_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 46,
"rows_produced_per_join": 1,
"filtered": "4.00",
"cost_info": {
"read_cost": "5.15",
"eval_cost": "0.18",
"prefix_cost": "5.33",
"data_read_per_join": "7K"
},
"used_columns": [
"category_id",
"storefront_id",
"usergroup_ids",
"status"
],
"attached_condition": "((`test2_gaseus`.`cscart_categories`.`storefront_id` in (0,1)) and ((`test2_gaseus`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`test2_gaseus`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`test2_gaseus`.`cscart_categories`.`usergroup_ids`))) and (`test2_gaseus`.`cscart_categories`.`status` in ('A','H')))"
}
},
{
"table": {
"table_name": "cscart_products_categories",
"access_type": "ref",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id"
],
"key_length": "3",
"ref": [
"test2_gaseus.cscart_categories.category_id"
],
"rows_examined_per_scan": 83,
"rows_produced_per_join": 0,
"filtered": "0.60",
"index_condition": "(`test2_gaseus`.`cscart_products_categories`.`product_id` in (3929,3930,3931,6724,3100,3106,3114,3120,3125,3153,3154,6672,6688,6689,6694,6702,6706,6708,6726,6725,3103,3097,3113,6687,6699,36,37,38,39,40,41,42,83,84,85,86,87,88,89,147,148,149,150,151,152,153,168,169))",
"cost_info": {
"read_cost": "38.18",
"eval_cost": "0.09",
"prefix_cost": "58.78",
"data_read_per_join": "14"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
},
{
"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",
"test2_gaseus.cscart_products_categories.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 0,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.23",
"eval_cost": "0.09",
"prefix_cost": "59.10",
"data_read_per_join": "14"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 36 |
273M |
0 |
| 37 |
273M |
0 |
| 38 |
273M |
0 |
| 39 |
273M |
0 |
| 40 |
273M |
0 |
| 41 |
273M |
0 |
| 42 |
273M |
0 |
| 83 |
273M |
0 |
| 84 |
273M |
0 |
| 85 |
273M |
0 |
| 86 |
273M |
0 |
| 87 |
273M |
0 |
| 88 |
273M |
0 |
| 89 |
273M |
0 |
| 147 |
273M |
0 |
| 148 |
273M |
0 |
| 149 |
273M |
0 |
| 150 |
273M |
0 |
| 151 |
273M |
0 |
| 152 |
273M |
0 |
| 153 |
273M |
0 |
| 168 |
273M |
0 |
| 169 |
273M |
0 |
| 3097 |
273M |
0 |
| 3100 |
273M |
0 |
| 3103 |
273M |
0 |
| 3106 |
273M |
0 |
| 3113 |
273M |
0 |
| 3114 |
273M |
0 |
| 3120 |
273M |
0 |
| 3125 |
273M |
0 |
| 3153 |
273M |
0 |
| 3154 |
273M |
0 |
| 3929 |
273M |
0 |
| 3930 |
273M |
0 |
| 3931 |
273M |
0 |
| 6672 |
273M |
0 |
| 6687 |
273M |
0 |
| 6688 |
273M |
0 |
| 6689 |
273M |
0 |
| 6694 |
273M |
0 |
| 6699 |
273M |
0 |
| 6702 |
273M |
0 |
| 6706 |
273M |
0 |
| 6708 |
273M |
0 |
| 6724 |
273M |
0 |
| 6725 |
273M |
0 |
| 6726 |
273M |
0 |