diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-02-15 13:53:24 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-02-15 13:53:24 -0500 |
commit | 5262f7a4fc44f651241d2ff1fa688dd664a34874 (patch) | |
tree | 8bccf6ebd560f5e081cbba37efa0ecb40d017fd2 /src/test | |
parent | 51ee6f3160d2e1515ed6197594bda67eb99dc2cc (diff) |
Add optimizer and executor support for parallel index scans.
In combination with 569174f1be92be93f5366212cc46960d28a5c5cd, which
taught the btree AM how to perform parallel index scans, this allows
parallel index scan plans on btree indexes. This infrastructure
should be general enough to support parallel index scans for other
index AMs as well, if someone updates them to support parallel
scans.
Amit Kapila, reviewed and tested by Anastasia Lubennikova, Tushar
Ahuja, and Haribabu Kommi, and me.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/expected/select_parallel.out | 23 | ||||
-rw-r--r-- | src/test/regress/sql/select_parallel.sql | 11 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/test/regress/expected/select_parallel.out b/src/test/regress/expected/select_parallel.out index 3692d4f1b81..48fb80e90c8 100644 --- a/src/test/regress/expected/select_parallel.out +++ b/src/test/regress/expected/select_parallel.out @@ -125,6 +125,29 @@ select count(*) from tenk1 where (two, four) not in (1 row) alter table tenk2 reset (parallel_workers); +-- test parallel index scans. +set enable_seqscan to off; +set enable_bitmapscan to off; +explain (costs off) + select count((unique1)) from tenk1 where hundred > 1; + QUERY PLAN +-------------------------------------------------------------------- + Finalize Aggregate + -> Gather + Workers Planned: 4 + -> Partial Aggregate + -> Parallel Index Scan using tenk1_hundred on tenk1 + Index Cond: (hundred > 1) +(6 rows) + +select count((unique1)) from tenk1 where hundred > 1; + count +------- + 9800 +(1 row) + +reset enable_seqscan; +reset enable_bitmapscan; set force_parallel_mode=1; explain (costs off) select stringu1::int2 from tenk1 where unique1 = 1; diff --git a/src/test/regress/sql/select_parallel.sql b/src/test/regress/sql/select_parallel.sql index f4f9dd5ab67..f5bc4d18733 100644 --- a/src/test/regress/sql/select_parallel.sql +++ b/src/test/regress/sql/select_parallel.sql @@ -48,6 +48,17 @@ select count(*) from tenk1 where (two, four) not in (select hundred, thousand from tenk2 where thousand > 100); alter table tenk2 reset (parallel_workers); +-- test parallel index scans. +set enable_seqscan to off; +set enable_bitmapscan to off; + +explain (costs off) + select count((unique1)) from tenk1 where hundred > 1; +select count((unique1)) from tenk1 where hundred > 1; + +reset enable_seqscan; +reset enable_bitmapscan; + set force_parallel_mode=1; explain (costs off) |