Query time 0.00141
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "68.13"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "7.68"
},
"nested_loop": [
{
"table": {
"table_name": "cscart_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 40,
"rows_produced_per_join": 1,
"filtered": "4.00",
"cost_info": {
"read_cost": "4.54",
"eval_cost": "0.16",
"prefix_cost": "4.70",
"data_read_per_join": "6K"
},
"used_columns": [
"category_id",
"storefront_id",
"usergroup_ids",
"status"
],
"attached_condition": "((`gaseus`.`cscart_categories`.`storefront_id` in (0,1)) and ((`gaseus`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`gaseus`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`gaseus`.`cscart_categories`.`usergroup_ids`))) and (`gaseus`.`cscart_categories`.`status` in ('A','H')))"
}
},
{
"table": {
"table_name": "cscart_products_categories",
"access_type": "range",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "pt",
"used_key_parts": [
"product_id"
],
"key_length": "3",
"rows_examined_per_scan": 48,
"rows_produced_per_join": 7,
"filtered": "10.00",
"index_condition": "(`gaseus`.`cscart_products_categories`.`product_id` in (191,192,193,194,195,226,227,228,229,230,231,232,264,265,266,267,268,269,270,318,319,320,321,322,323,3961,3962,3963,3964,3965,3966,3967,4006,4007,4008,4009,4010,4011,4012,4066,4067,4068,4069,4070,4071,4072,4073,4074))",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "46.10",
"eval_cost": "0.77",
"prefix_cost": "58.48",
"data_read_per_join": "122"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
],
"attached_condition": "(`gaseus`.`cscart_products_categories`.`category_id` = `gaseus`.`cscart_categories`.`category_id`)"
}
},
{
"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",
"gaseus.cscart_products_categories.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 7,
"filtered": "100.00",
"cost_info": {
"read_cost": "1.20",
"eval_cost": "0.77",
"prefix_cost": "60.45",
"data_read_per_join": "122"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 191 |
273M |
0 |
| 192 |
273M |
0 |
| 193 |
273M |
0 |
| 194 |
273M |
0 |
| 195 |
273M |
0 |
| 226 |
273M |
0 |
| 227 |
273M |
0 |
| 228 |
273M |
0 |
| 229 |
273M |
0 |
| 230 |
273M |
0 |
| 231 |
273M |
0 |
| 232 |
273M |
0 |
| 264 |
273M |
0 |
| 265 |
273M |
0 |
| 266 |
273M |
0 |
| 267 |
273M |
0 |
| 268 |
273M |
0 |
| 269 |
273M |
0 |
| 270 |
273M |
0 |
| 318 |
273M |
0 |
| 319 |
273M |
0 |
| 320 |
273M |
0 |
| 321 |
273M |
0 |
| 322 |
273M |
0 |
| 323 |
273M |
0 |
| 3961 |
273M |
0 |
| 3962 |
273M |
0 |
| 3963 |
273M |
0 |
| 3964 |
273M |
0 |
| 3965 |
273M |
0 |
| 3966 |
273M |
0 |
| 3967 |
273M |
0 |
| 4006 |
273M |
0 |
| 4007 |
273M |
0 |
| 4008 |
273M |
0 |
| 4009 |
273M |
0 |
| 4010 |
273M |
0 |
| 4011 |
273M |
0 |
| 4012 |
273M |
0 |
| 4066 |
273M |
0 |
| 4067 |
273M |
0 |
| 4068 |
273M |
0 |
| 4069 |
273M |
0 |
| 4070 |
273M |
0 |
| 4071 |
273M |
0 |
| 4072 |
273M |
0 |
| 4073 |
273M |
0 |
| 4074 |
273M |
0 |