文章目录
- 初始化节点时每个节点时候观察estate->es_tupleTable
初始化节点时每个节点时候观察estate->es_tupleTable
select test1.id1,test1.id1 from test1 inner join test2 on test1.id1=test2.id3;
- 我设置了2个断点
ExecInitNestLoop
ExecInitSeqScan
-
结果如下
-
先进入ExecInitSeqScan
- 其实是先进入ExecInitNestLoop
-
然后ExecInitSeqScan这个函数把estate->es_tupleTable
- 这里增加了两个slot,用于放置ScanTupleSlot和ResultTupleSlot
-
另一个ExecInitSeqScan也增加两个
- 其实并不是这样,另一个居然是物化节点
-
查询计划显示如下
postgres=# explain select test1.id1 from test1 ,test2 where test1.id1=test2.id3;
QUERY PLAN
---------------------------------------------------------------------
Nested Loop (cost=0.00..76684.85 rows=25538 width=4)
Join Filter: (test1.id1 = test2.id3)
-> Seq Scan on test1 (cost=0.00..32.60 rows=2260 width=4)
-> Materialize (cost=0.00..43.90 rows=2260 width=4)
-> Seq Scan on test2 (cost=0.00..32.60 rows=2260 width=4)
(5 rows)
print(length(estate->es_tupleTable))