Query time 0.00203
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "166.75"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "28.61"
},
"nested_loop": [
{
"table": {
"table_name": "cscart_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 383,
"rows_produced_per_join": 15,
"filtered": "4.00",
"cost_info": {
"read_cost": "40.09",
"eval_cost": "1.53",
"prefix_cost": "41.62",
"data_read_per_join": "81K"
},
"used_columns": [
"category_id",
"storefront_id",
"usergroup_ids",
"status"
],
"attached_condition": "((`test_uchur_k`.`cscart_categories`.`storefront_id` in (0,1)) and ((`test_uchur_k`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`test_uchur_k`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`test_uchur_k`.`cscart_categories`.`usergroup_ids`))) and (`test_uchur_k`.`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": [
"test_uchur_k.cscart_categories.category_id"
],
"rows_examined_per_scan": 18,
"rows_produced_per_join": 28,
"filtered": "10.38",
"index_condition": "(`test_uchur_k`.`cscart_products_categories`.`product_id` in (82,51129,51128,51127,51126,51125,48,51139,51138,51137,51136,51135,40,51158,51157,51156,53,51160,51159,51176,51174,51173,51172,91,51194,51193,51192,51191,51190,51189,19,51246,51245,51244,35,51248,51247,17,16,54,51313,51312,51314,51311,51310,51323,51322,51321,51320,50,51324,105,57,51354,51353,43,51361,30,51362,51363,51364,51365))",
"cost_info": {
"read_cost": "68.94",
"eval_cost": "2.86",
"prefix_cost": "138.14",
"data_read_per_join": "457"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
| 16 |
6,44,40M |
| 17 |
6,44,40M |
| 19 |
44,9,40M |
| 30 |
44,18,391,40M |
| 35 |
44,7,40M |
| 40 |
10,44,40M |
| 43 |
20,44,40M |
| 48 |
10,44,40M |
| 50 |
23,44,40M |
| 53 |
10,44,40M |
| 54 |
44,24,40M |
| 57 |
6,44,40M |
| 82 |
44,8,394,40M |
| 91 |
44,9,40M |
| 105 |
44,6,394,40M |
| 51125 |
10,44,40M |
| 51126 |
44,10,40M |
| 51127 |
44,10,40M |
| 51128 |
44,10,40M |
| 51129 |
44,10,40M |
| 51135 |
44,10,40M |
| 51136 |
44,10,40M |
| 51137 |
44,10,40M |
| 51138 |
44,10,40M |
| 51139 |
44,10,40M |
| 51156 |
44,10,40M |
| 51157 |
44,10,40M |
| 51158 |
44,10,40M |
| 51159 |
44,10,40M |
| 51160 |
44,10,40M |
| 51172 |
9,44,40M |
| 51173 |
44,9,40M |
| 51174 |
9,44,40M |
| 51176 |
9,44,40M |
| 51189 |
9,44,40M |
| 51190 |
9,44,40M |
| 51191 |
9,44,40M |
| 51192 |
9,44,40M |
| 51193 |
9,44,40M |
| 51194 |
9,44,40M |
| 51244 |
7,44,40M |
| 51245 |
7,44,40M |
| 51246 |
7,44,40M |
| 51247 |
7,44,40M |
| 51248 |
7,44,40M |
| 51310 |
24,44,40M |
| 51311 |
24,44,40M |
| 51312 |
24,44,40M |
| 51313 |
24,44,40M |
| 51314 |
24,44,40M |
| 51320 |
44,23,40M |
| 51321 |
44,23,40M |
| 51322 |
44,23,40M |
| 51323 |
44,23,40M |
| 51324 |
44,23,40M |
| 51353 |
44,20,40M |
| 51354 |
44,20,40M |
| 51361 |
391,18,44,40M |
| 51362 |
391,18,44,40M |
| 51363 |
391,18,44,40M |
| 51364 |
391,18,44,40M |
| 51365 |
18,44,391,40M |