Query time 0.00111
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "31.64"
},
"grouping_operation": {
"using_filesort": false,
"nested_loop": [
{
"table": {
"table_name": "products_categories",
"access_type": "range",
"possible_keys": [
"PRIMARY",
"link_type",
"pt"
],
"key": "pt",
"used_key_parts": [
"product_id"
],
"key_length": "3",
"rows_examined_per_scan": 57,
"rows_produced_per_join": 57,
"filtered": "100.00",
"using_index": true,
"cost_info": {
"read_cost": "6.00",
"eval_cost": "5.70",
"prefix_cost": "11.70",
"data_read_per_join": "912"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
],
"attached_condition": "(`goimagine`.`products_categories`.`product_id` in (272778,147881,270039,232479,247145,147871,147836,270005,147869,270008,147878,270009))"
}
},
{
"table": {
"table_name": "categories",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id"
],
"key_length": "3",
"ref": [
"goimagine.products_categories.category_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 2,
"filtered": "5.00",
"cost_info": {
"read_cost": "14.25",
"eval_cost": "0.29",
"prefix_cost": "31.65",
"data_read_per_join": "7K"
},
"used_columns": [
"category_id",
"usergroup_ids",
"status",
"storefront_id"
],
"attached_condition": "((`goimagine`.`categories`.`storefront_id` in (0,1)) and ((`goimagine`.`categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`goimagine`.`categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`goimagine`.`categories`.`usergroup_ids`))) and (`goimagine`.`categories`.`status` in ('A','H')))"
}
}
]
}
}
}
Result
| product_id |
category_ids |
| 147836 |
370,9263,9971,20047,14M |
| 147869 |
370,9263,9971,20047,14M |
| 147871 |
372,9263,9971,20047,14M |
| 147878 |
9289,9971,10891,319M |
| 147881 |
14,9264,9971,368M |
| 232479 |
370,9912,9971,14M |
| 247145 |
370,9263,9971,20047,14M |
| 270005 |
379,9288,9971,20045,20046,253M |
| 270008 |
370,9912,9971,14M |
| 270009 |
370,9912,9971,20047,369M |
| 270039 |
9289,9971,10891,12M |
| 272778 |
370,9912,9971,10183,20047,14M |