Query time 0.00123
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 (327,328,329,330,415,416,417,418,3616,3617,3618,4080,4081,4082,4083,4084,4085,4086,4156,4157,4158,4159,4160,4161,4162,4209,4210,4211,4212,4213,4214,4215,3102,3110,6670,6685,6698,3095,3101,3108,6683,6697,3099,19,20,21,3929,3930))",
"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 |
| 19 |
273M |
0 |
| 20 |
273M |
0 |
| 21 |
273M |
0 |
| 327 |
273M |
0 |
| 328 |
273M |
0 |
| 329 |
273M |
0 |
| 330 |
273M |
0 |
| 415 |
273M |
0 |
| 416 |
273M |
0 |
| 417 |
273M |
0 |
| 418 |
273M |
0 |
| 3095 |
273M |
0 |
| 3099 |
273M |
0 |
| 3101 |
273M |
0 |
| 3102 |
273M |
0 |
| 3108 |
273M |
0 |
| 3110 |
273M |
0 |
| 3616 |
273M |
0 |
| 3617 |
273M |
0 |
| 3618 |
273M |
0 |
| 3929 |
273M |
0 |
| 3930 |
273M |
0 |
| 4080 |
273M |
0 |
| 4081 |
273M |
0 |
| 4082 |
273M |
0 |
| 4083 |
273M |
0 |
| 4084 |
273M |
0 |
| 4085 |
273M |
0 |
| 4086 |
273M |
0 |
| 4156 |
273M |
0 |
| 4157 |
273M |
0 |
| 4158 |
273M |
0 |
| 4159 |
273M |
0 |
| 4160 |
273M |
0 |
| 4161 |
273M |
0 |
| 4162 |
273M |
0 |
| 4209 |
273M |
0 |
| 4210 |
273M |
0 |
| 4211 |
273M |
0 |
| 4212 |
273M |
0 |
| 4213 |
273M |
0 |
| 4214 |
273M |
0 |
| 4215 |
273M |
0 |
| 6670 |
273M |
0 |
| 6683 |
273M |
0 |
| 6685 |
273M |
0 |
| 6697 |
273M |
0 |
| 6698 |
273M |
0 |