Query time 0.00103
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "125.61"
},
"grouping_operation": {
"using_filesort": false,
"nested_loop": [
{
"table": {
"table_name": "q_products_categories",
"access_type": "range",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "pt",
"used_key_parts": [
"product_id"
],
"key_length": "3",
"rows_examined_per_scan": 36,
"rows_produced_per_join": 36,
"filtered": "100.00",
"index_condition": "(`portal`.`q_products_categories`.`product_id` in (30800,30801,30802,30803,30804,30805,30806,30807,30808,30809,30810,30811,30812,30813,30814,30815,30816,30817,30818,30819,30820,30821,30822,30823,30824,30825,30826,30827,30828,30829,30830,30831))",
"cost_info": {
"read_cost": "75.21",
"eval_cost": "7.20",
"prefix_cost": "82.41",
"data_read_per_join": "576"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
},
{
"table": {
"table_name": "q_categories",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id"
],
"key_length": "3",
"ref": [
"portal.q_products_categories.category_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 7,
"filtered": "20.00",
"cost_info": {
"read_cost": "36.00",
"eval_cost": "1.44",
"prefix_cost": "125.61",
"data_read_per_join": "19K"
},
"used_columns": [
"category_id",
"usergroup_ids",
"status"
],
"attached_condition": "(((`portal`.`q_categories`.`usergroup_ids` = '') or find_in_set(0,`portal`.`q_categories`.`usergroup_ids`) or find_in_set(1,`portal`.`q_categories`.`usergroup_ids`)) and (`portal`.`q_categories`.`status` in ('A','H')))"
}
}
]
}
}
}
Result
product_id |
category_ids |
30800 |
189M |
30801 |
462M |
30802 |
566M |
30803 |
419M |
30804 |
111M |
30805 |
166M |
30806 |
167M |
30807 |
64M |
30808 |
184M |
30809 |
233M |
30810 |
64M |
30811 |
539M |
30812 |
545M |
30813 |
159M |
30814 |
64M |
30815 |
529M |
30816 |
582M |
30817 |
275M |
30818 |
64M |
30819 |
2M |
30820 |
217M |
30821 |
160M |
30822 |
586M |
30823 |
166M |
30824 |
63M |
30825 |
159M |
30826 |
581M |
30827 |
160M |
30828 |
537M |
30829 |
187M |
30830 |
519M |
30831 |
446M |