Query time 0.00087
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "20.53"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "2.10"
},
"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": 15,
"rows_produced_per_join": 2,
"filtered": "10.00",
"index_condition": "(`primapearl_r_new`.`cscart_products_categories`.`product_id` in (8724,8723,8518,8706,8707,8513,8514,8520,8521,8516,8515,8517))",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "11.56",
"eval_cost": "0.21",
"prefix_cost": "17.84",
"data_read_per_join": "33"
},
"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": 2,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.38",
"eval_cost": "0.21",
"prefix_cost": "18.43",
"data_read_per_join": "33"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 8513 |
278M |
0 |
| 8514 |
278M |
0 |
| 8515 |
278M |
0 |
| 8516 |
278M |
0 |
| 8517 |
278M |
0 |
| 8518 |
278M |
0 |
| 8520 |
275,278M |
0 |
| 8521 |
275,278M |
0 |
| 8706 |
450,278M |
0 |
| 8707 |
450,278M |
0 |
| 8723 |
278M |
0 |
| 8724 |
278M |
0 |