515,122573,167938))",
"access_type": "range"
}
]
},
{
"reconsidering_access_paths_for_index_ordering": {
//到了order by id这边时,MySQL改变了执行计划,选择了PRIMARY主键索引
"clause": "ORDER BY",
"index_order_summary": {
"table": "`report_product_sales_data`",
"index_provides_order": true,
"order_direction": "desc",
"disabled_pushed_condition_on_old_index": true,
"index": "PRIMARY",
"plan_changed": true,
"access_type": "index_scan"
}
}
}
]
}
},
{
"join_execution": {
"select#": 1,
"steps": [
]
}
}
]
}
explain select product_id, sales_num, report_date from `report_product_sales_data`
where `hq_code` = '000030'
and `orgz_id` = 229
and `product_id` in (11453,11472,11487,11446,11456,12088,11433,114170,11479,11491,11485,11482,70672,68998,154298,11435,11481,11515,122573,167938)
and `report_date` > '2018-05-11'
order by `report_date` desc limit 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE report_product_sales_data range report_product_sales_data_unique,report_product_sales_data_hq_code_orgz_id_index report_product_sales_data_hq_code_orgz_id_index 55 NULL 37088 Using index condition; Using where