查询计划
查询计划是由计划节点组成的树,每个计划节点代表一个特定类型的处理操作,计划节点中包括了执行器执行所需的全部信息。
计划节点分为几个类型:
-
扫描节点:包括顺序扫描,索引扫描,位图扫描等
-
连接节点:包括Nestloop,hash,merge等
-
聚集节点: Hash Aggregate , Group Aggregate
-
分布式节点: Redistribute Motion,Broadcast Motion,Gather Motion
-
其他: Hash、Sort、Limit、Append等
一个典型的查询计划长这样
EXPLAIN SELECT * FROM t1, t2 WHERE t1.a = t2.a;
QUERY PLAN
-----------------------------------------------------------------------------------------------------Gather Motion 156:1 (slice1; segments: 156) (cost=0.00..862.00 rows=1 width=16)
-> Hash Join (cost=0.00..862.00 rows=1 width=16)
Hash Cond: (t1.a = t2.a)
-> Seq Scan on t1 (cost=0.00..431.00 rows=1 wi