no_pushdown_joinqual

用在查询语句上,确定连接条件均不下推到视图中

举例:

--  清理环境
drop table t1 cascade;
drop table t2 cascade;

--  开启连接条件下推参数
set ENABLE_PUSHDOWN_SUBQUERY_JOINQUAL = TRUE;
--  创建表
create table t1(a int);
create table t2(a int);


--  使用no_pushdown_joinqual
explain select /*+ no_pushdown_joinqual */ * from t1,(select * from t2 group by a) tt where t1.a = tt.a;
QUERY PLAN(text)      
----------------------
Hash Join(Inner Join)  (cost=112.90..510.02 rows=8192 width=8)
  Hash Cond: ("outer".A = "inner".A)
  ->  Seq Scan on T1  (cost=0.00..89.92 rows=8192 width=4)
  ->  Hash  (cost=110.40..110.40 rows=200 width=4)
        ->  Subquery Scan TT  (cost=110.40..110.40 rows=200 width=4)
              ->  HashAggregate  (cost=110.40..110.40 rows=200 width=4)
                    Group Key: A
                    ->  Seq Scan on T2  (cost=0.00..89.92 rows=8192 width=4)
总数目:8


--  不使用no_pushdown_joinqual
explain select * from t1,(select * from t2 group by a) tt where t1.a = tt.a;
QUERY PLAN(text)      
----------------------
Nested Loop(Inner Join)  (cost=110.50..364.26 rows=8192 width=8)
  ->  Seq Scan on T1  (cost=0.00..89.92 rows=8192 width=4)
  ->  Materialize  (cost=110.50..110.51 rows=1 width=4)
        ->  Subquery Scan TT  (cost=110.50..110.50 rows=1 width=4)
              ->  HashAggregate  (cost=110.50..110.50 rows=1 width=4)
                    Group Key: A
                    ->  Seq Scan on T2  (cost=0.00..110.40 rows=41 width=4)
                          Filter: ($0 = A)
总数目:8

--  删除表
drop table t1 cascade;
drop table t2 cascade;

--  还原连接条件下推参数
reset ENABLE_PUSHDOWN_SUBQUERY_JOINQUAL;