query optimizer:查询优化器。数据库管理系统(DBMS)中的一个核心组件,用来为一条 SQL 查询选择更高效的执行方式(执行计划),例如选择合适的索引、连接顺序与连接算法、是否并行执行等,以降低查询成本(时间、I/O、CPU、内存)。
/ˈkwɪəri ˈɒptɪmaɪzər/
/ˈkwɪri ˈɑːptɪmaɪzər/
The query optimizer chose an index to speed up the search.
查询优化器选择了一个索引来加快搜索速度。
Because the tables were large and the statistics were outdated, the query optimizer produced a slow execution plan until we refreshed the stats and added a composite index.
由于表很大且统计信息过期,查询优化器生成了一个很慢的执行计划;在我们更新统计信息并添加复合索引后,性能才改善。
query 源自拉丁语 quaerere(“寻找、询问”),在计算机领域指“向数据库发出的检索请求”。optimize/optimizer 来自拉丁语 optimus(“最好的”),表示“使之更优/做出最优选择的人或机制”。合起来 query optimizer 就是“为查询选择更优执行方式的机制”。