Query time 0.00186
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "34.39"
},
"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": 62,
"rows_produced_per_join": 62,
"filtered": "100.00",
"using_index": true,
"cost_info": {
"read_cost": "6.49",
"eval_cost": "6.20",
"prefix_cost": "12.69",
"data_read_per_join": "992"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
],
"attached_condition": "(`goimagine`.`products_categories`.`product_id` in (139291,145768,120811,166202,132820,164913,111953,127087,108250,127081,139306,111948))"
}
},
{
"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": 3,
"filtered": "5.00",
"cost_info": {
"read_cost": "15.50",
"eval_cost": "0.31",
"prefix_cost": "34.39",
"data_read_per_join": "8K"
},
"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 |
| 108250 |
106,5843,6365,78M |
| 111948 |
100,6247,45M |
| 111953 |
100,6247,45M |
| 120811 |
2M |
| 127081 |
87,5843,6817,7221,7712,52M |
| 127087 |
87,5843,6817,7221,7712,52M |
| 132820 |
5843,6366,6817,7405,7651,7695,8489,8694,6692M |
| 139291 |
5843,6370,6817,7651,7695,8488,8499,109M |
| 139306 |
82,2M |
| 145768 |
78,5843,6817,7695,8443,8498,45M |
| 164913 |
100,5843,6370,6817,7695,10333,10482,45M |
| 166202 |
197,5843,6817,7695,45M |