Query time 0.00432
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "176.96"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "28.76"
},
"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.43",
"index_condition": "(`test_uchur_k`.`cscart_products_categories`.`product_id` in (22,18,27,119,121,141,23,4,142,120,62,108,107,94,8,86,54,132,10,93,12,32,7,130,35,16,112,3,78,33,89,2,110,114,34,77,147,36,87,128,96,20,52,84,118,109,66,131,19,13,61,146,95,15,9,85,83,22421,111,59,22424,60,144,123))",
"cost_info": {
"read_cost": "68.94",
"eval_cost": "2.88",
"prefix_cost": "138.14",
"data_read_per_join": "460"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
},
{
"table": {
"table_name": "product_position_source",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id",
"product_id"
],
"key_length": "6",
"ref": [
"const",
"test_uchur_k.cscart_products_categories.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 28,
"filtered": "100.00",
"cost_info": {
"read_cost": "7.19",
"eval_cost": "2.88",
"prefix_cost": "148.20",
"data_read_per_join": "460"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 2 |
4,40M,42 |
0 |
| 3 |
4,40M,42 |
0 |
| 4 |
6,40M,42 |
0 |
| 7 |
7,40M,42 |
0 |
| 8 |
7,40M,42,390 |
0 |
| 9 |
6,40M,42 |
0 |
| 10 |
6,40M,42 |
0 |
| 12 |
7,40M,42,390 |
0 |
| 13 |
6,40M,42 |
0 |
| 15 |
6,40M,43 |
0 |
| 16 |
6,40M,44 |
0 |
| 18 |
6,40M,43 |
0 |
| 19 |
9,40M,44 |
0 |
| 20 |
9,40M,43 |
0 |
| 22 |
6,40M,42 |
0 |
| 23 |
6,40M,42 |
0 |
| 27 |
6,40M,42 |
0 |
| 32 |
7,40M,42 |
0 |
| 33 |
7,40M,42 |
0 |
| 34 |
7,40M,42 |
0 |
| 35 |
7,40M,44 |
0 |
| 36 |
7,40M,43 |
0 |
| 52 |
9,40M,42 |
0 |
| 54 |
24,40M,44 |
0 |
| 59 |
6,40M,42 |
0 |
| 60 |
6,40M,42 |
0 |
| 61 |
6,40M,42 |
0 |
| 62 |
6,40M,42 |
0 |
| 66 |
4,40M,42 |
0 |
| 77 |
21,40M |
0 |
| 78 |
21,40M |
0 |
| 83 |
40M,42,312,352 |
0 |
| 84 |
28,40M,42,394 |
0 |
| 85 |
28,40M,42,394 |
0 |
| 86 |
29,40M,43,394 |
0 |
| 87 |
21,40M |
0 |
| 89 |
25,40M,42 |
0 |
| 93 |
9,40M,42 |
0 |
| 94 |
7,40M,43 |
0 |
| 95 |
31,40M,43 |
0 |
| 96 |
32,40M,42 |
0 |
| 107 |
33,40M,42 |
0 |
| 108 |
33,40M,42 |
0 |
| 109 |
7,40M,42 |
0 |
| 110 |
7,40M,42 |
0 |
| 111 |
7,40M,42 |
0 |
| 112 |
21,40M,44 |
0 |
| 114 |
6,40M,42 |
0 |
| 118 |
6,40M,42 |
0 |
| 119 |
6,40M,42 |
0 |
| 120 |
6,40M,42 |
0 |
| 121 |
6,40M,42 |
0 |
| 123 |
6,40M,42 |
0 |
| 128 |
10,40M,43 |
0 |
| 130 |
10,40M,42 |
0 |
| 131 |
9,40M,42 |
0 |
| 132 |
35,40M,42 |
0 |
| 141 |
6,40M,42 |
0 |
| 142 |
6,40M,42 |
0 |
| 144 |
7,40M,42,390 |
0 |
| 146 |
7,40M,42,390 |
0 |
| 147 |
7,40M,42 |
0 |
| 22421 |
40,133M |
0 |
| 22424 |
40,133M |
0 |