Query time 0.00669
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "30.48"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "1.76"
},
"nested_loop": [
{
"table": {
"table_name": "cscart_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 59,
"rows_produced_per_join": 2,
"filtered": "4.00",
"cost_info": {
"read_cost": "6.40",
"eval_cost": "0.24",
"prefix_cost": "6.64",
"data_read_per_join": "6K"
},
"used_columns": [
"category_id",
"storefront_id",
"usergroup_ids",
"status"
],
"attached_condition": "((`wearethehelpful_scalesta_net`.`cscart_categories`.`storefront_id` in (0,1)) and ((`wearethehelpful_scalesta_net`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`wearethehelpful_scalesta_net`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`wearethehelpful_scalesta_net`.`cscart_categories`.`usergroup_ids`))) and (`wearethehelpful_scalesta_net`.`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": [
"wearethehelpful_scalesta_net.cscart_categories.category_id"
],
"rows_examined_per_scan": 26,
"rows_produced_per_join": 1,
"filtered": "2.86",
"index_condition": "(`wearethehelpful_scalesta_net`.`cscart_products_categories`.`product_id` in (2021,2017,2016,1909,1275,1271,1267,1264,1262,1258,1246,1245))",
"cost_info": {
"read_cost": "15.34",
"eval_cost": "0.18",
"prefix_cost": "28.11",
"data_read_per_join": "28"
},
"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",
"wearethehelpful_scalesta_net.cscart_products_categories.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 1,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.44",
"eval_cost": "0.18",
"prefix_cost": "28.73",
"data_read_per_join": "28"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 1245 |
288,310,308,309,297,278M,276 |
0 |
| 1246 |
297,310,308,309,278M,276,288 |
0 |
| 1258 |
310,276,297,288,309,308,278M |
0 |
| 1262 |
310,297,309,278M,288,308,276 |
0 |
| 1264 |
309,288,308,297,276,310,278M |
0 |
| 1267 |
276,308,310,309,278M,288,297 |
0 |
| 1271 |
288,297,309,308,278M,310,276 |
0 |
| 1275 |
308,310,278M,276,309,297,288 |
0 |
| 1909 |
314,294M,267,288,276 |
0 |
| 2016 |
292M |
|
| 2017 |
292M |
|
| 2021 |
292M |
|