Query time 0.00121
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "76.54"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "9.28"
},
"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": 58,
"rows_produced_per_join": 9,
"filtered": "10.00",
"index_condition": "(`gaseus`.`cscart_products_categories`.`product_id` in (11887,11909,11929,11936,11940,11944,11951,11958,11959,11960,11961,11962,11963,11964,11965,12030,12031,12032,12033,12034,12035,12036,12037,12102,12116,12118,12132,12146,12160,12174,12188,12202,8203,8214,8215,8216,8217,8218,8205,8206,8207,8208,8209,8210,8211,8212))",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "50.90",
"eval_cost": "0.93",
"prefix_cost": "64.88",
"data_read_per_join": "148"
},
"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": 9,
"filtered": "100.00",
"cost_info": {
"read_cost": "1.45",
"eval_cost": "0.93",
"prefix_cost": "67.26",
"data_read_per_join": "148"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 8203 |
306M |
0 |
| 8205 |
306M |
0 |
| 8206 |
306M |
0 |
| 8207 |
306M |
0 |
| 8208 |
306M |
0 |
| 8209 |
306M |
0 |
| 8210 |
306M |
0 |
| 8211 |
306M |
0 |
| 8212 |
306M |
0 |
| 8214 |
306M |
0 |
| 8215 |
306M |
0 |
| 8216 |
306M |
0 |
| 8217 |
306M |
0 |
| 8218 |
306M |
0 |
| 11887 |
306M |
0 |
| 11909 |
306M |
0 |
| 11929 |
306M |
0 |
| 11936 |
306M |
0 |
| 11940 |
306M |
0 |
| 11944 |
306M |
0 |
| 11951 |
306M |
0 |
| 11958 |
306M |
0 |
| 11959 |
306M |
0 |
| 11960 |
306M |
0 |
| 11961 |
306M |
0 |
| 11962 |
306M |
0 |
| 11963 |
306M |
0 |
| 11964 |
306M |
0 |
| 11965 |
306M |
0 |
| 12030 |
306M |
0 |
| 12031 |
306M |
0 |
| 12032 |
306M |
0 |
| 12033 |
306M |
0 |
| 12034 |
306M |
0 |
| 12035 |
306M |
0 |
| 12036 |
306M |
0 |
| 12037 |
306M |
0 |
| 12102 |
306M |
0 |
| 12116 |
306M |
0 |
| 12118 |
306M |
0 |
| 12132 |
306M |
0 |
| 12146 |
306M |
0 |
| 12160 |
306M |
0 |
| 12174 |
306M |
0 |
| 12188 |
306M |
0 |
| 12202 |
306M |
0 |