Query time 0.00108
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "185.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": 41,
"rows_produced_per_join": 41,
"filtered": "100.00",
"index_condition": "(`portal`.`q_products_categories`.`product_id` in (29790,29793,29794,29796,29800,29801,29806,29813,29818,29825,29829,29832,29833,29834,29835,29836,29838,29843,29849,29850,29852,29854,29860,29862,29864,29876,29878,29904,29905,30349))",
"cost_info": {
"read_cost": "79.21",
"eval_cost": "8.20",
"prefix_cost": "87.41",
"data_read_per_join": "656"
},
"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": 41,
"filtered": "100.00",
"cost_info": {
"read_cost": "41.00",
"eval_cost": "8.20",
"prefix_cost": "136.61",
"data_read_per_join": "656"
},
"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": 8,
"filtered": "20.00",
"cost_info": {
"read_cost": "41.00",
"eval_cost": "1.64",
"prefix_cost": "185.81",
"data_read_per_join": "21K"
},
"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 |
29790 |
193,195M |
|
29793 |
191M |
|
29794 |
193M |
|
29796 |
195M |
|
29800 |
204M |
|
29801 |
419M |
|
29806 |
193M |
|
29813 |
419M |
|
29818 |
420M |
|
29825 |
419M |
|
29829 |
419M |
|
29832 |
556M |
|
29833 |
419M |
|
29834 |
204M |
|
29835 |
420M |
|
29836 |
193M |
|
29838 |
420M |
|
29843 |
419M |
|
29849 |
419M |
|
29850 |
419M |
|
29852 |
419M |
|
29854 |
204M |
|
29860 |
204M |
|
29862 |
195M |
|
29864 |
193M |
|
29876 |
197M |
|
29878 |
386M |
|
29904 |
204M |
|
29905 |
204M |
|
30349 |
428M |
|