Query time 0.00102
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "110.66"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "4.94"
},
"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": 4,
"filtered": "8.17",
"index_condition": "(`cscart`.`cscart_products_categories`.`product_id` in (735,734,733,732,731,730,729,728,742,741,740,739,738,737,736,747,746,745,744,743,758,757,756,755,754,753,767,766,765,764,763,762,773,772,771))",
"cost_info": {
"read_cost": "62.90",
"eval_cost": "0.99",
"prefix_cost": "105.72",
"data_read_per_join": "79"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
| 728 |
382M,377,375 |
| 729 |
382M,377,375 |
| 730 |
382M,377,375 |
| 731 |
375,382M,377 |
| 732 |
375,382M,377 |
| 733 |
375,382M,377 |
| 734 |
377,375,382M |
| 735 |
382M,377,375 |
| 736 |
382M,377,375 |
| 737 |
375,382M,377 |
| 738 |
375,382M,377 |
| 739 |
375,382M,377 |
| 740 |
375,382M,377 |
| 741 |
382M,377,375 |
| 742 |
382M,377,375 |
| 743 |
382M,377,375 |
| 744 |
375,382M,377 |
| 745 |
375,382M,377 |
| 746 |
375,382M,377 |
| 747 |
382M,377,375 |
| 753 |
382M,377,375 |
| 754 |
382M,377,375 |
| 755 |
375,382M,377 |
| 756 |
375,382M,377 |
| 757 |
375,382M,377 |
| 758 |
377,375,382M |
| 762 |
382M,377,375 |
| 763 |
382M,377,375 |
| 764 |
375,382M,377 |
| 765 |
375,382M,377 |
| 766 |
375,382M,377 |
| 767 |
375,382M,377 |
| 771 |
376,381M,375 |
| 772 |
376,381M,375 |
| 773 |
376,381M,375 |