Query time 0.00101
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "151.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": 46,
"rows_produced_per_join": 46,
"filtered": "100.00",
"index_condition": "(`portal`.`q_products_categories`.`product_id` in (29201,29202,29203,29204,29205,29206,29207,29208,29209,29210,29211,29212,29213,29214,29215,29216,29218,29219,29220,29221,29222,29223,29224,29225,29226,29227,29228,29229,29230,29231,29232,29233))",
"cost_info": {
"read_cost": "87.21",
"eval_cost": "9.20",
"prefix_cost": "96.41",
"data_read_per_join": "736"
},
"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": 9,
"filtered": "20.00",
"cost_info": {
"read_cost": "46.00",
"eval_cost": "1.84",
"prefix_cost": "151.61",
"data_read_per_join": "24K"
},
"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 |
29201 |
200M |
29202 |
383M |
29203 |
197M |
29204 |
560M |
29205 |
401M |
29206 |
560M |
29207 |
385M |
29208 |
560M |
29209 |
560M |
29210 |
560M |
29211 |
200M |
29212 |
428M |
29213 |
428M |
29214 |
560M |
29215 |
428M |
29216 |
195M |
29218 |
560M |
29219 |
401M |
29220 |
432M |
29221 |
560M |
29222 |
560M |
29223 |
200M |
29224 |
299M |
29225 |
200M |
29226 |
560M |
29227 |
201M |
29228 |
385M |
29229 |
560M |
29230 |
201M |
29231 |
560M |
29232 |
546,512M |
29233 |
206M |