Query time 0.00110
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "26.24"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "2.15"
},
"nested_loop": [
{
"table": {
"table_name": "cscart_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 68,
"rows_produced_per_join": 2,
"filtered": "4.00",
"cost_info": {
"read_cost": "7.63",
"eval_cost": "0.27",
"prefix_cost": "7.91",
"data_read_per_join": "9K"
},
"used_columns": [
"category_id",
"storefront_id",
"usergroup_ids",
"status"
],
"attached_condition": "((`cscartdevel`.`cscart_categories`.`storefront_id` in (0,1)) and ((`cscartdevel`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`cscartdevel`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`cscartdevel`.`cscart_categories`.`usergroup_ids`))) and (`cscartdevel`.`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": [
"cscartdevel.cscart_categories.category_id"
],
"rows_examined_per_scan": 17,
"rows_produced_per_join": 2,
"filtered": "4.65",
"index_condition": "(`cscartdevel`.`cscart_products_categories`.`product_id` in (1914,1915,1761,2203,1789,1811,1791,1889,1836,1799,1845,1792,1905,1806,1837,2282,2002,1940,2295,2283,1970,2387,2014,2355,1996,2286,2285,2310,1997,1956,1971,2316,1955,2334,2108,2360,2287,2288,2009,1950,2109,2107,2221,2023,2123,1982,1944,2031,2032,1920,2033,2034,2165,2223,2190,1758,2365,2067,2294,2070,2069,1835,1871,2241,2351,2091,1959,1981,2137,2340,1745,2209,2063,2370,2377,1916,2381,2392,1838,1766))",
"cost_info": {
"read_cost": "11.56",
"eval_cost": "0.22",
"prefix_cost": "24.09",
"data_read_per_join": "34"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
}
]
}
}
}
Result
product_id |
category_ids |
1745 |
386M |
1758 |
390M |
1761 |
386M |
1766 |
303M |
1789 |
388M |
1791 |
388M |
1792 |
388M |
1799 |
388M |
1806 |
388M |
1811 |
388M |
1835 |
303M |
1836 |
388M |
1837 |
388M |
1838 |
303M |
1845 |
388M |
1871 |
303M |
1889 |
388M |
1905 |
388M |
1914 |
299M |
1915 |
299M |
1916 |
299M |
1920 |
397M |
1940 |
321M |
1944 |
397M |
1950 |
321M |
1955 |
321M |
1956 |
321M |
1959 |
348M |
1970 |
321M |
1971 |
321M |
1981 |
348M |
1982 |
397M |
1996 |
321M |
1997 |
321M |
2002 |
321M |
2009 |
321M |
2014 |
321M |
2023 |
397M |
2031 |
397M |
2032 |
397M |
2033 |
397M |
2034 |
397M |
2063 |
362M |
2067 |
390M |
2069 |
324M |
2070 |
324M |
2091 |
348M |
2107 |
321M |
2108 |
321M |
2109 |
321M |
2123 |
397M |
2137 |
348M |
2165 |
397M |
2190 |
299M |
2203 |
395M |
2209 |
324M |
2221 |
397M |
2223 |
397M |
2241 |
313M |
2282 |
321M |
2283 |
321M |
2285 |
321M |
2286 |
321M |
2287 |
321M |
2288 |
321M |
2294 |
390M |
2295 |
321M |
2310 |
321M |
2316 |
321M |
2334 |
321M |
2340 |
348M |
2351 |
324M |
2355 |
321M |
2360 |
321M |
2365 |
390M |
2370 |
362M |
2377 |
299M |
2381 |
299M |
2387 |
321M |
2392 |
313M |