Query time 0.01031
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "60.78"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "0.64"
},
"nested_loop": [
{
"table": {
"table_name": "jmj_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 120,
"rows_produced_per_join": 4,
"filtered": "4.00",
"cost_info": {
"read_cost": "28.46",
"eval_cost": "0.96",
"prefix_cost": "29.42",
"data_read_per_join": "18K"
},
"used_columns": [
"category_id",
"usergroup_ids",
"status",
"storefront_id"
],
"attached_condition": "((`jmj_test`.`jmj_categories`.`storefront_id` in (0,1)) and ((`jmj_test`.`jmj_categories`.`usergroup_ids` = '') or find_in_set(0,`jmj_test`.`jmj_categories`.`usergroup_ids`) or find_in_set(1,`jmj_test`.`jmj_categories`.`usergroup_ids`)) and (`jmj_test`.`jmj_categories`.`status` in ('A','H')))"
}
},
{
"table": {
"table_name": "jmj_products_categories",
"access_type": "ref",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id"
],
"key_length": "3",
"ref": [
"jmj_test.jmj_categories.category_id"
],
"rows_examined_per_scan": 5,
"rows_produced_per_join": 0,
"filtered": "2.67",
"index_condition": "(`jmj_test`.`jmj_products_categories`.`product_id` in (1701,1708,1726,1694,1693,1712,1715,1716,1718,1724,1722,1736))",
"cost_info": {
"read_cost": "25.15",
"eval_cost": "0.13",
"prefix_cost": "59.37",
"data_read_per_join": "10"
},
"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",
"jmj_test.jmj_products_categories.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 0,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.64",
"eval_cost": "0.13",
"prefix_cost": "60.14",
"data_read_per_join": "10"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 1693 |
88M |
|
| 1694 |
109M |
|
| 1701 |
111M |
|
| 1708 |
114M |
|
| 1712 |
116M |
|
| 1715 |
117M |
|
| 1716 |
118M |
|
| 1718 |
119M |
|
| 1722 |
120M |
|
| 1724 |
121M |
|
| 1726 |
122M |
|
| 1736 |
112M |
|