Query time 0.00134
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "111.93"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "7.79"
},
"nested_loop": [
{
"table": {
"table_name": "cscart_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 125,
"rows_produced_per_join": 5,
"filtered": "4.00",
"cost_info": {
"read_cost": "29.49",
"eval_cost": "1.00",
"prefix_cost": "30.49",
"data_read_per_join": "20K"
},
"used_columns": [
"category_id",
"storefront_id",
"usergroup_ids",
"status"
],
"attached_condition": "((`cscart`.`cscart_categories`.`storefront_id` in (0,1)) and ((`cscart`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`cscart`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`cscart`.`cscart_categories`.`usergroup_ids`)) and (`cscart`.`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": [
"cscart.cscart_categories.category_id"
],
"rows_examined_per_scan": 12,
"rows_produced_per_join": 7,
"filtered": "12.98",
"index_condition": "(`cscart`.`cscart_products_categories`.`product_id` in (965,966,1013,1014,666,711,713,714,715,716,717,718,719,725,726,727,663,703,704,706,707,708,709,710,607,608,623,624,960,961,962,963,964,601,602,603,604,797,798,799,800,801,802,803,804,805,806,807,808,809,810,813,814,822,823,720,721,722,723,724))",
"cost_info": {
"read_cost": "61.65",
"eval_cost": "1.56",
"prefix_cost": "104.14",
"data_read_per_join": "124"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
| 601 |
305M,329,303 |
| 602 |
305M,329,303 |
| 603 |
303,305M,329 |
| 604 |
303,305M,329 |
| 607 |
333M,335,343 |
| 608 |
333M,335,343 |
| 623 |
333M,335,343 |
| 624 |
333M,335,343 |
| 663 |
313M,415 |
| 666 |
312,313M,415 |
| 703 |
313M,415 |
| 704 |
313M,415 |
| 706 |
313M,415 |
| 707 |
415,313M |
| 708 |
313M,415 |
| 709 |
313M,415 |
| 710 |
313M,415 |
| 711 |
312,313M,415 |
| 713 |
312,313M,415 |
| 714 |
312,313M,415 |
| 715 |
313M,415,312 |
| 716 |
312,313M,415 |
| 717 |
312,313M,415 |
| 718 |
312,313M,415 |
| 719 |
312,313M,415 |
| 720 |
415M |
| 721 |
415M |
| 722 |
415M |
| 723 |
415M |
| 724 |
415M |
| 725 |
402M,312,313 |
| 726 |
313,402M,312 |
| 727 |
312,313,402M |
| 797 |
392,396M,393 |
| 798 |
392,396M,393 |
| 799 |
392,396M,393 |
| 800 |
393,392,396M |
| 801 |
396M,393,392 |
| 802 |
392,396M,393 |
| 803 |
392,396M,393 |
| 804 |
392,396M,393 |
| 805 |
392,396M,393 |
| 806 |
393,392,396M |
| 807 |
396M,393,392 |
| 808 |
392,396M,393 |
| 809 |
392,396M,393 |
| 810 |
392,396M,393 |
| 813 |
392,397M,394 |
| 814 |
392,397M,394 |
| 822 |
395,392,398M |
| 823 |
392,398M,395 |
| 960 |
335M,341,333 |
| 961 |
333,335M,341 |
| 962 |
342M,333,335 |
| 963 |
342M,333,335 |
| 964 |
342M,333,335 |
| 965 |
344M,333,335 |
| 966 |
335,344M,333 |
| 1013 |
309,356M,345 |
| 1014 |
309,356M,345 |