
demo=# explain (analyze , buffers) select * from student s , teacher t ;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------
Nested Loop (cost=0.00..9714.75 rows=774000 width=128) (actual time=0.014..0.020 rows=16 loops=1)
Buffers: shared hit=2
-> Seq Scan on teacher t (cost=0.00..19.00 rows=900 width=62) (actual time=0.007..0.007 rows=4 loops=1)
Buffers: shared hit=1
-> Materialize (cost=0.00..22.90 rows=860 width=66) (actual time=0.001..0.002 rows=4 loops=4)
Buffers: shared hit=1
-> Seq Scan on student s (cost=0.00..18.60 rows=860 width=66) (actual time=0.002..0.003 rows=4 loops=1)
Buffers: shared hit=1
按照从上到下顺序的话,Seq Scan on teacher t 和Materialize 是平行的,就是先执行Seq Scan on teacher t
要按照先里后外或者从右到左,得先执行Seq Scan on student s ,
所以感觉挺矛盾的,到底如何正确理解呢??请高手指点