Query time 0.00117
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "116.05"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "8.36"
},
"nested_loop": [
{
"table": {
"table_name": "cscart_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 126,
"rows_produced_per_join": 5,
"filtered": "4.00",
"cost_info": {
"read_cost": "29.72",
"eval_cost": "1.01",
"prefix_cost": "30.73",
"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": 8,
"filtered": "13.83",
"index_condition": "(`cscart`.`cscart_products_categories`.`product_id` in (599,600,601,602,603,604,605,606,675,676,677,911,912,914,915,916,917,922,923,924,925,926,927,928,929,930,931,596,597,672,673,674,678,679,680,880,881,882,883,890,891,892,893,896,897,898,899,900,901,902,903,904,905,906,907,934,935,937,938,939,940,1094,1149,1150,1151))",
"cost_info": {
"read_cost": "64.86",
"eval_cost": "1.67",
"prefix_cost": "107.69",
"data_read_per_join": "133"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
| 596 |
303,326,304M |
| 597 |
303,326,304M |
| 599 |
303M,329,305 |
| 600 |
305,303M,329 |
| 601 |
305M,303,329 |
| 602 |
329,305M,303 |
| 603 |
303,329,305M |
| 604 |
303,329,305M |
| 605 |
303M,329,305 |
| 606 |
305,303M,329 |
| 672 |
304M,326,303 |
| 673 |
304M,326,303 |
| 674 |
303,304M,326 |
| 675 |
305,303M,329 |
| 676 |
305,303M,329 |
| 677 |
329,305,303M |
| 678 |
315,317,303M |
| 679 |
315,317,303M |
| 680 |
315,317,303M |
| 880 |
317M,303,315 |
| 881 |
317M,303,315 |
| 882 |
315,318M,303 |
| 883 |
315,318M,303 |
| 890 |
316,321M,303 |
| 891 |
316,321M,303 |
| 892 |
322M,303,304 |
| 893 |
322M,303,304 |
| 896 |
322M,303,304 |
| 897 |
322M,303,304 |
| 898 |
304,322M,303 |
| 899 |
304,322M,303 |
| 900 |
303,304M,322 |
| 901 |
322,303,304M |
| 902 |
325M,303,304 |
| 903 |
325M,303,304 |
| 904 |
304,325M,303 |
| 905 |
304,325M,303 |
| 906 |
304,325M,303 |
| 907 |
325M,303,304 |
| 911 |
327M,303,305 |
| 912 |
327M,303,305 |
| 914 |
327M,303,305 |
| 915 |
305,327M,303 |
| 916 |
305,327M,303 |
| 917 |
303,305,327M |
| 922 |
303,305,328M |
| 923 |
328M,303,305 |
| 924 |
328M,303,305 |
| 925 |
305,328M,303 |
| 926 |
305,329M,303 |
| 927 |
305,329M,303 |
| 928 |
303,305,329M |
| 929 |
303,305,329M |
| 930 |
303,305,329M |
| 931 |
305,329M,303 |
| 934 |
330M,314,303 |
| 935 |
330M,314,303 |
| 937 |
303,332M,314 |
| 938 |
314,303,332M |
| 939 |
314,303,332M |
| 940 |
332M,314,303 |
| 1094 |
314M |
| 1149 |
314M |
| 1150 |
314M |
| 1151 |
314M |