Query time 0.00306
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "167.79"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "29.65"
},
"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": 29,
"filtered": "10.75",
"index_condition": "(`test_uchur_k`.`cscart_products_categories`.`product_id` in (128,51118,51117,51116,51115,51114,51113,49,51132,51131,51134,51133,51130,41,51155,51154,51153,51152,21,51169,51168,51167,51166,90,51171,51170,51183,20,51188,51187,51186,51185,51184,51243,51242,51241,51240,51239,36,51294,51293,51291,51290,94,18,81,51318,51317,51316,51,51319,106,58,86,15,95,51356,51355,44,31,51366,51367,51368,51369))",
"cost_info": {
"read_cost": "68.94",
"eval_cost": "2.97",
"prefix_cost": "138.14",
"data_read_per_join": "474"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
| 15 |
6,43,40M |
| 18 |
6,43,40M |
| 20 |
43,9,40M |
| 21 |
43,10,40M |
| 31 |
43,391,18,40M |
| 36 |
43,7,40M |
| 41 |
10,43,40M |
| 44 |
20,43,40M |
| 49 |
10,43,40M |
| 51 |
23,43,40M |
| 58 |
6,43,40M |
| 81 |
43,8,394,40M |
| 86 |
43,29,394,40M |
| 90 |
43,9,40M |
| 94 |
43,7,40M |
| 95 |
31,43,40M |
| 106 |
43,6,394,40M |
| 128 |
43,10,40M |
| 51113 |
10,43,40M |
| 51114 |
10,43,40M |
| 51115 |
10,43,40M |
| 51116 |
10,43,40M |
| 51117 |
10,43,40M |
| 51118 |
10,43,40M |
| 51130 |
43,10,40M |
| 51131 |
43,10,40M |
| 51132 |
43,10,40M |
| 51133 |
43,10,40M |
| 51134 |
43,10,40M |
| 51152 |
10,43,40M |
| 51153 |
10,43,40M |
| 51154 |
10,43,40M |
| 51155 |
10,43,40M |
| 51166 |
9,43,40M |
| 51167 |
9,43,40M |
| 51168 |
9,43,40M |
| 51169 |
43,9,40M |
| 51170 |
9,43,40M |
| 51171 |
9,43,40M |
| 51183 |
9,43,40M |
| 51184 |
9,43,40M |
| 51185 |
9,43,40M |
| 51186 |
9,43,40M |
| 51187 |
9,43,40M |
| 51188 |
9,43,40M |
| 51239 |
7,43,40M |
| 51240 |
7,43,40M |
| 51241 |
7,43,40M |
| 51242 |
7,43,40M |
| 51243 |
7,43,40M |
| 51290 |
7,43,40M |
| 51291 |
7,43,40M |
| 51293 |
7,43,40M |
| 51294 |
7,43,40M |
| 51316 |
23,43,40M |
| 51317 |
43,23,40M |
| 51318 |
43,23,40M |
| 51319 |
43,23,40M |
| 51355 |
43,20,40M |
| 51356 |
43,20,40M |
| 51366 |
18,391,43,40M |
| 51367 |
391,43,18,40M |
| 51368 |
391,43,18,40M |
| 51369 |
391,43,18,40M |