Query time 0.00136
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "26.93"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "0.52"
},
"nested_loop": [
{
"table": {
"table_name": "cscart_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 35,
"rows_produced_per_join": 1,
"filtered": "4.00",
"cost_info": {
"read_cost": "4.04",
"eval_cost": "0.14",
"prefix_cost": "4.18",
"data_read_per_join": "6K"
},
"used_columns": [
"category_id",
"usergroup_ids",
"status",
"storefront_id"
],
"attached_condition": "((`primapearl_r_new`.`cscart_categories`.`storefront_id` in (0,1)) and ((`primapearl_r_new`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`primapearl_r_new`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`primapearl_r_new`.`cscart_categories`.`usergroup_ids`))) and (`primapearl_r_new`.`cscart_categories`.`status` in ('A','H')))"
}
},
{
"table": {
"table_name": "cscart_products_categories",
"access_type": "ref",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id"
],
"key_length": "3",
"ref": [
"primapearl_r_new.cscart_categories.category_id"
],
"rows_examined_per_scan": 45,
"rows_produced_per_join": 0,
"filtered": "0.83",
"index_condition": "(`primapearl_r_new`.`cscart_products_categories`.`product_id` in (7056,7425,7368,7068,7047,7380,7061,8423,7372,7034,7046,7426,7369,7373,7275,7374,7058,7445,7387,7045,7371,7392,8712,7367,7284,7393,7366))",
"cost_info": {
"read_cost": "15.75",
"eval_cost": "0.05",
"prefix_cost": "26.23",
"data_read_per_join": "8"
},
"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",
"primapearl_r_new.cscart_products_categories.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 0,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.13",
"eval_cost": "0.05",
"prefix_cost": "26.41",
"data_read_per_join": "8"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 7034 |
275,265M |
0 |
| 7045 |
265M,275 |
0 |
| 7046 |
275,265M |
0 |
| 7047 |
275,265M |
0 |
| 7056 |
275,265M |
0 |
| 7058 |
265M,275 |
0 |
| 7061 |
275,265M |
0 |
| 7068 |
275,265M |
0 |
| 7275 |
265M |
0 |
| 7284 |
265M,372 |
0 |
| 7366 |
265M |
0 |
| 7367 |
265M |
0 |
| 7368 |
265M |
0 |
| 7369 |
265M |
0 |
| 7371 |
265M |
0 |
| 7372 |
265M |
0 |
| 7373 |
265M |
0 |
| 7374 |
265M |
0 |
| 7380 |
265M |
0 |
| 7387 |
265M |
0 |
| 7392 |
265M |
0 |
| 7393 |
265M,372 |
0 |
| 7425 |
265M |
0 |
| 7426 |
265M |
0 |
| 7445 |
265M |
0 |
| 8423 |
265M,375 |
0 |
| 8712 |
265M |
0 |