Query time 0.00128
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "36.46"
},
"grouping_operation": {
"using_filesort": false,
"nested_loop": [
{
"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": 40,
"rows_produced_per_join": 40,
"filtered": "100.00",
"index_condition": "(`test_uchur_k`.`cscart_products_categories`.`product_id` in (145,113,6,14,44,43,50995,133,18516,50983,51436,51433,51435,51432,51434))",
"cost_info": {
"read_cost": "17.76",
"eval_cost": "4.00",
"prefix_cost": "21.76",
"data_read_per_join": "640"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
},
{
"table": {
"table_name": "cscart_categories",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id"
],
"key_length": "3",
"ref": [
"test_uchur_k.cscart_products_categories.category_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 2,
"filtered": "5.00",
"cost_info": {
"read_cost": "10.00",
"eval_cost": "0.20",
"prefix_cost": "35.76",
"data_read_per_join": "10K"
},
"used_columns": [
"category_id",
"storefront_id",
"usergroup_ids",
"status"
],
"attached_condition": "((`test_uchur_k`.`cscart_categories`.`storefront_id` in (0,1)) and ((`test_uchur_k`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`test_uchur_k`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`test_uchur_k`.`cscart_categories`.`usergroup_ids`))) and (`test_uchur_k`.`cscart_categories`.`status` in ('A','H')))"
}
},
{
"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",
"test_uchur_k.cscart_products_categories.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 2,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.50",
"eval_cost": "0.20",
"prefix_cost": "36.46",
"data_read_per_join": "32"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 6 |
6,42,40M |
0 |
| 14 |
6,42,40M |
0 |
| 43 |
20,44,40M |
0 |
| 44 |
20,43,40M |
0 |
| 113 |
6,42,40M |
0 |
| 133 |
4,42,40M |
0 |
| 145 |
42,7,390,40M |
0 |
| 18516 |
44,40,221M |
0 |
| 50983 |
40,133M |
0 |
| 50995 |
42,40,352M |
0 |
| 51432 |
73,40M |
0 |
| 51433 |
73,40M |
0 |
| 51434 |
73,40M |
0 |
| 51435 |
73,40M |
0 |
| 51436 |
73,40M |
0 |