Query time 0.00109
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "120.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": 34,
"rows_produced_per_join": 34,
"filtered": "100.00",
"index_condition": "(`portal`.`q_products_categories`.`product_id` in (6137,6138,6139,6140,6141,6142,6143,6144,6145,6146,6147,6148,6149,6150,6151,6152,6153,6154,6155,6156,6157,6158,6159,6160,6161,6162,6163,6164,6165,6166,6167,5845))",
"cost_info": {
"read_cost": "72.81",
"eval_cost": "6.80",
"prefix_cost": "79.61",
"data_read_per_join": "544"
},
"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": 6,
"filtered": "20.00",
"cost_info": {
"read_cost": "34.00",
"eval_cost": "1.36",
"prefix_cost": "120.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 |
5845 |
418M |
6137 |
402M |
6138 |
402M |
6139 |
193,199,402M |
6140 |
193,402M |
6141 |
193,199,402M |
6142 |
193,402M |
6143 |
193,402M |
6144 |
193,402M |
6145 |
193,402M |
6146 |
193,402M |
6147 |
193,402M |
6148 |
193,402M |
6149 |
193,402M |
6150 |
193,402M |
6151 |
193,402M |
6152 |
402M |
6153 |
193,402M |
6154 |
193,402M |
6155 |
402M |
6156 |
193,402M |
6157 |
193,402M |
6158 |
193,402M |
6159 |
193,402M |
6160 |
193,402M |
6161 |
402M |
6162 |
193,402M |
6163 |
193,402M |
6164 |
402M |
6165 |
402M |
6166 |
193,402M |
6167 |
199,402M |