摘要:
在分析包含内连接的嵌套外连接的过程中, 发现optimizer_switch参数derived_merge控制多个表连接是否使用派生表, 本文对其做分析.
派生表:
派生表即为from子句出现的查询结果集当做一张表,或者from后面是一个视图, 或者是在多表连接过程中。优化器在处理derived table时有两种策略,第一种是将derived table合并到外层查询中,第二种是将derived table物化为一个临时表。优化器开关derived_merge控制选择哪种策略,如果设置为on,则是选择策略1,如果设置为off,则是选择策略2。此开关从5.7.6版本引入,默认值为on。
optimizer_switch控制
参数分类:
index_merge=on,
index_merge_union=on,
index_merge_sort_union=on,
index_merge_intersection=on,
engine_condition_pushdown=on,
index_condition_pushdown=on,
use_index_extensions=on,
mrr=on,
mrr_cost_based=on,
blo