Query time 0.00099
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "7.51"
},
"nested_loop": [
{
"table": {
"table_name": "ushop_product_sales",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"pa"
],
"rows_examined_per_scan": 21,
"rows_produced_per_join": 14,
"filtered": "66.67",
"cost_info": {
"read_cost": "1.21",
"eval_cost": "1.40",
"prefix_cost": "2.61",
"data_read_per_join": "224"
},
"used_columns": [
"category_id",
"product_id",
"amount"
],
"attached_condition": "(`marketplace`.`ushop_product_sales`.`product_id` in (430,428,429,289,287,307,292,452,516,447,517,296,361,297))"
}
},
{
"table": {
"table_name": "ushop_products_categories",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"link_type",
"pt"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id",
"product_id"
],
"key_length": "6",
"ref": [
"marketplace.ushop_product_sales.category_id",
"marketplace.ushop_product_sales.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 13,
"filtered": "98.80",
"cost_info": {
"read_cost": "3.50",
"eval_cost": "1.38",
"prefix_cost": "7.51",
"data_read_per_join": "221"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
],
"attached_condition": "(`marketplace`.`ushop_products_categories`.`link_type` = 'M')"
}
}
]
}
}
Result
| product_id |
sales_amount |
| 517 |
6 |
| 428 |
2 |
| 516 |
4 |
| 430 |
1 |
| 447 |
1 |