Query time 0.00137
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "139.19"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "0.77"
},
"nested_loop": [
{
"table": {
"table_name": "cscart_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 115,
"rows_produced_per_join": 2,
"filtered": "2.00",
"cost_info": {
"read_cost": "27.56",
"eval_cost": "0.46",
"prefix_cost": "28.02",
"data_read_per_join": "6K"
},
"used_columns": [
"category_id",
"company_id",
"usergroup_ids",
"status"
],
"attached_condition": "((`eshopuga_upgr_4122`.`cscart_categories`.`company_id` = 1) and ((`eshopuga_upgr_4122`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`eshopuga_upgr_4122`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`eshopuga_upgr_4122`.`cscart_categories`.`usergroup_ids`)) and (`eshopuga_upgr_4122`.`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": [
"eshopuga_upgr_4122.cscart_categories.category_id"
],
"rows_examined_per_scan": 40,
"rows_produced_per_join": 0,
"filtered": "0.84",
"index_condition": "(`eshopuga_upgr_4122`.`cscart_products_categories`.`product_id` in (322,779,780,787,566,578,1049,1226,1939))",
"cost_info": {
"read_cost": "92.00",
"eval_cost": "0.15",
"prefix_cost": "138.42",
"data_read_per_join": "12"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
}
]
}
}
}
Result
product_id |
category_ids |
322 |
355,369,339,375,353,356,341,374,352,357,342,373,350,358,338,372,351,378,349M,371,345,377,354,370,344,376 |
566 |
413M |
578 |
413M |
779 |
435,432M |
780 |
435,432M |
787 |
435,432M |
1049 |
435M |
1226 |
398M |
1939 |
435M |