Query time 0.00081
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "157.41"
},
"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": 33,
"rows_produced_per_join": 33,
"filtered": "100.00",
"index_condition": "(`portal`.`q_products_categories`.`product_id` in (9701,9702,9703,9704,9705,9706,9707,9708,9709,9710,9711,9712,9713,9714,9715,9716,9718,9719,9720,9721,9722,9723,9724,9725,9726,9727,9731,9732,9780,9781,9788,9851))",
"cost_info": {
"read_cost": "71.61",
"eval_cost": "6.60",
"prefix_cost": "78.21",
"data_read_per_join": "528"
},
"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": 33,
"filtered": "100.00",
"cost_info": {
"read_cost": "33.00",
"eval_cost": "6.60",
"prefix_cost": "117.81",
"data_read_per_join": "528"
},
"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": "33.00",
"eval_cost": "1.32",
"prefix_cost": "157.41",
"data_read_per_join": "17K"
},
"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 |
9701 |
418M |
|
9702 |
191M |
0 |
9703 |
418M |
|
9704 |
418M |
|
9705 |
191M |
0 |
9706 |
418M |
|
9707 |
418M |
|
9708 |
418M |
|
9709 |
418M |
|
9710 |
418M |
|
9711 |
418M |
|
9712 |
418M |
|
9713 |
418M |
|
9714 |
418M |
|
9715 |
418M |
|
9716 |
418M |
|
9718 |
418M |
|
9719 |
418M |
|
9720 |
418M |
|
9721 |
418M |
|
9722 |
418M |
|
9723 |
418M |
|
9724 |
191M |
0 |
9725 |
418M |
|
9726 |
418M |
|
9727 |
418M |
|
9731 |
418M |
|
9732 |
418M |
|
9780 |
418M |
|
9781 |
418M |
|
9788 |
419M |
|
9851 |
191M |
0 |