打开 PDQ 时,SET EXPLAIN 输出显示优化器是否选择了并行扫描。如果优化器选择了并行扫描,那么输出将列出 Parallel。(如果关闭了 PDQ,那么输出将列出 Serial。)
如果打开 PDQ,那么优化器还会指示响应查询所需的最大线程数。SET EXPLAIN 输出中的 # of Secondary Threads 字段指示除了用户会话线程之外所需的线程数。必需的线程总数为辅助线程数加上 1。
SELECT * FROM t1 WHERE c1 > 20 Estimated Cost: 2 Estimated # of Rows Returned: 2 1) gbasedbt.t1: SEQUENTIAL SCAN (Parallel, fragments: 2) Filters: gbasedbt.t1.c1 > 20 # of Secondary Threads = 1
QUERY: ------ SELECT h1.c1, h2.c1 FROM h1, h2 WHERE h1.c1 = h2.c1 Estimated Cost: 2 Estimated # of Rows Returned: 5 1) gbasedbt.h1: SEQUENTIAL SCAN (Parallel, fragments: ALL) 2) gbasedbt.h2: SEQUENTIAL SCAN (Parallel, fragments: ALL) DYNAMIC HASH JOIN (Build Outer) Dynamic Hash Filters: gbasedbt.h1.c1 = gbasedbt.h2.c1 # of Secondary Threads = 6
SELECT * FROM t1 WHERE c1 < 13 Estimated Cost: 2 Estimated # of Rows Returned: 1 1) gbasedbt.t1: INDEX PATH (1) Index Keys: c1 (Parallel, fragments: ALL) Upper Index Filter: gbasedbt.t1.c1 < 13 # of Secondary Threads = 3