Query time 0.00703
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "61.80"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "2.43"
},
"nested_loop": [
{
"table": {
"table_name": "jmj_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 120,
"rows_produced_per_join": 4,
"filtered": "4.00",
"cost_info": {
"read_cost": "28.46",
"eval_cost": "0.96",
"prefix_cost": "29.42",
"data_read_per_join": "18K"
},
"used_columns": [
"category_id",
"usergroup_ids",
"status",
"storefront_id"
],
"attached_condition": "((`jmj_test`.`jmj_categories`.`storefront_id` in (0,1)) and ((`jmj_test`.`jmj_categories`.`usergroup_ids` = '') or find_in_set(0,`jmj_test`.`jmj_categories`.`usergroup_ids`) or find_in_set(1,`jmj_test`.`jmj_categories`.`usergroup_ids`)) and (`jmj_test`.`jmj_categories`.`status` in ('A','H')))"
}
},
{
"table": {
"table_name": "jmj_products_categories",
"access_type": "ref",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id"
],
"key_length": "3",
"ref": [
"jmj_test.jmj_categories.category_id"
],
"rows_examined_per_scan": 5,
"rows_produced_per_join": 2,
"filtered": "10.11",
"index_condition": "(`jmj_test`.`jmj_products_categories`.`product_id` in (938,939,942,943,944,945,946,947,948,949,951,952,953,954,956,958,960,962,963,965,967,968,969,970,972,973,974,975,976,977,978,979,980,981,984,985,986,987,988,989,990,991,992,993,994,995,996,997))",
"cost_info": {
"read_cost": "25.15",
"eval_cost": "0.49",
"prefix_cost": "59.37",
"data_read_per_join": "38"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
| 938 |
10M |
| 939 |
10M |
| 942 |
10M |
| 943 |
10M |
| 944 |
10M |
| 945 |
10M |
| 946 |
10M |
| 947 |
10M |
| 948 |
10M |
| 949 |
10M |
| 951 |
10M |
| 952 |
10M |
| 953 |
10M |
| 954 |
10M |
| 956 |
10M |
| 958 |
10M |
| 960 |
10M |
| 962 |
10M |
| 963 |
10M |
| 965 |
10M |
| 967 |
10M |
| 968 |
10M |
| 969 |
10M |
| 970 |
10M |
| 972 |
10M |
| 973 |
10M |
| 974 |
10M |
| 975 |
10M |
| 976 |
10M |
| 977 |
10M |
| 978 |
10M |
| 979 |
10M |
| 980 |
10M |
| 981 |
10M |
| 984 |
10M |
| 985 |
10M |
| 986 |
10M |
| 987 |
10M |
| 988 |
10M |
| 989 |
10M |
| 990 |
10M |
| 991 |
10M |
| 992 |
10M |
| 993 |
10M |
| 994 |
10M |
| 995 |
10M |
| 996 |
10M |
| 997 |
10M |