Query time 0.00111
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "27.26"
},
"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": 49,
"rows_produced_per_join": 49,
"filtered": "100.00",
"using_index": true,
"cost_info": {
"read_cost": "5.21",
"eval_cost": "4.90",
"prefix_cost": "10.11",
"data_read_per_join": "784"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
],
"attached_condition": "(`goimagine`.`products_categories`.`product_id` in (3800,3783,3925,3842,4182,3991,3821,3805,3806,59997,3839,3782))"
}
},
{
"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": "12.25",
"eval_cost": "0.25",
"prefix_cost": "27.26",
"data_read_per_join": "6K"
},
"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 |
3782 |
78,412,512,204M |
3783 |
415,512,964,78M |
3800 |
78,412,512,204M |
3805 |
46,411,512,124M |
3806 |
204,413,512,78M |
3821 |
78,415,512,3M |
3839 |
78,411,512,46M |
3842 |
78,422,512,75M |
3925 |
97,412,512,204M |
3991 |
268,416,512,78M |
4182 |
78,418,512,1549,20M |
59997 |
78,412,512,204M |