Query time 0.00083
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "28.40"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "3.22"
},
"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": "range",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "pt",
"used_key_parts": [
"product_id"
],
"key_length": "3",
"rows_examined_per_scan": 23,
"rows_produced_per_join": 3,
"filtered": "10.00",
"index_condition": "(`primapearl_r_new`.`cscart_products_categories`.`product_id` in (8522,7507,7966,7514,7963,7924,7964,8523,7548,7960,7821,7706,7512,7967,7962,7961))",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "16.88",
"eval_cost": "0.32",
"prefix_cost": "24.28",
"data_read_per_join": "51"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
],
"attached_condition": "(`primapearl_r_new`.`cscart_products_categories`.`category_id` = `primapearl_r_new`.`cscart_categories`.`category_id`)"
}
},
{
"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": 3,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.58",
"eval_cost": "0.32",
"prefix_cost": "25.18",
"data_read_per_join": "51"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 7507 |
274M,375 |
0 |
| 7512 |
375,274M |
0 |
| 7514 |
375,274M |
0 |
| 7548 |
275,274M |
0 |
| 7706 |
274M |
0 |
| 7821 |
274M |
0 |
| 7924 |
274M |
0 |
| 7960 |
274M |
0 |
| 7961 |
274M |
0 |
| 7962 |
274M |
0 |
| 7963 |
274M |
0 |
| 7964 |
274M |
0 |
| 7966 |
274M |
0 |
| 7967 |
274M |
0 |
| 8522 |
375,274M |
0 |
| 8523 |
375,274M |
0 |