Query time 0.00095
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "147.81"
},
"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": 31,
"rows_produced_per_join": 31,
"filtered": "100.00",
"index_condition": "(`portal`.`q_products_categories`.`product_id` in (3672,3673,3674,3676,3677,3678,3679,3680,3681,3682,3683,3684,3685,3686,3687,3688,3689,3690,3691,3692,3693,3694,3695,3696,3697,3698,3699,3700,3701,3702))",
"cost_info": {
"read_cost": "67.21",
"eval_cost": "6.20",
"prefix_cost": "73.41",
"data_read_per_join": "496"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
},
{
"table": {
"table_name": "product_position_source",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id",
"product_id"
],
"key_length": "6",
"ref": [
"const",
"portal.q_products_categories.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 31,
"filtered": "100.00",
"cost_info": {
"read_cost": "31.00",
"eval_cost": "6.20",
"prefix_cost": "110.61",
"data_read_per_join": "496"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
},
{
"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": 6,
"filtered": "20.00",
"cost_info": {
"read_cost": "31.00",
"eval_cost": "1.24",
"prefix_cost": "147.81",
"data_read_per_join": "16K"
},
"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 |
position |
3672 |
479,478M |
|
3673 |
479M |
|
3674 |
479M |
|
3676 |
479M |
|
3677 |
442,479M |
|
3678 |
478M |
|
3679 |
479M |
|
3680 |
479M |
|
3681 |
478M |
|
3682 |
479M |
|
3683 |
479M |
|
3684 |
479M |
|
3685 |
479M |
|
3686 |
479M |
|
3687 |
479M |
|
3688 |
479M |
|
3689 |
479M |
|
3690 |
479M |
|
3691 |
479M |
|
3692 |
478M |
|
3693 |
478M |
|
3694 |
479M |
|
3695 |
479M |
|
3696 |
478M |
|
3697 |
479M |
|
3698 |
478M |
|
3699 |
479M |
|
3700 |
479M |
|
3701 |
479M |
|
3702 |
479M |
|