Query time 0.00820
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "31.30"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "2.36"
},
"nested_loop": [
{
"table": {
"table_name": "cscart_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 59,
"rows_produced_per_join": 2,
"filtered": "4.00",
"cost_info": {
"read_cost": "6.40",
"eval_cost": "0.24",
"prefix_cost": "6.64",
"data_read_per_join": "6K"
},
"used_columns": [
"category_id",
"storefront_id",
"usergroup_ids",
"status"
],
"attached_condition": "((`wearethehelpful_scalesta_net`.`cscart_categories`.`storefront_id` in (0,1)) and ((`wearethehelpful_scalesta_net`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`wearethehelpful_scalesta_net`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`wearethehelpful_scalesta_net`.`cscart_categories`.`usergroup_ids`))) and (`wearethehelpful_scalesta_net`.`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": [
"wearethehelpful_scalesta_net.cscart_categories.category_id"
],
"rows_examined_per_scan": 26,
"rows_produced_per_join": 2,
"filtered": "3.84",
"index_condition": "(`wearethehelpful_scalesta_net`.`cscart_products_categories`.`product_id` in (1909,1136,1135,1134,1133,1132,1131,1130,1129,1128,1127,1126))",
"cost_info": {
"read_cost": "15.34",
"eval_cost": "0.24",
"prefix_cost": "28.11",
"data_read_per_join": "37"
},
"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",
"wearethehelpful_scalesta_net.cscart_products_categories.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 2,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.59",
"eval_cost": "0.24",
"prefix_cost": "28.94",
"data_read_per_join": "37"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 1126 |
300,288,297M,278,323,277,267,271,319,294,276 |
0 |
| 1127 |
309,323,288,319,276,294,277,278,297M,300,271,267 |
0 |
| 1128 |
271,288,300,266M,299,323,301,267,329,276,297 |
0 |
| 1129 |
266M,271,297,301,300,299,329,288,276,267,323 |
0 |
| 1130 |
329,266M,271,299,288,319,300,267,301,297,276,323 |
0 |
| 1131 |
300,329,323,301,299,266M,267,297,278,271,288,276 |
0 |
| 1132 |
325,298,305M,265 |
|
| 1133 |
325,265,305M,298 |
|
| 1134 |
265,305M,298,325 |
|
| 1135 |
305M,265,325,298 |
|
| 1136 |
325,298,265,305M |
|
| 1909 |
267,288,294M,314,276 |
0 |