From 16f2cdc95df26484aa3553d43fc88eb9add007c0 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Tue, 10 Jan 2023 10:40:02 +0900 Subject: [PATCH] Add test to check behavior of parallel hints under default setup Currently, parallel hints on single relations cannot be enforced properly without the GUCs related to parallelism to be reset first. Perhaps there is not much of a use-case when it comes to that, but let's add some regression tests to check this default behavior, as there was nothing to check that in the existing test suite. Per pull request #112. Backpatch-through: 10 --- expected/ut-W.out | 33 +++++++++++++++++++++++++++++++++ sql/ut-W.sql | 6 ++++++ 2 files changed, 39 insertions(+) diff --git a/expected/ut-W.out b/expected/ut-W.out index 6a90f3b2e82c..6e2ee0697bb3 100644 --- a/expected/ut-W.out +++ b/expected/ut-W.out @@ -10,6 +10,39 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1; Seq Scan on t1 (1 row) +-- Note that parallel is not enforced on a single relation without +-- the GUCs related to parallelism reset. +/*+Parallel(s1.t1 5 hard)*/ +EXPLAIN (COSTS false) SELECT * FROM s1.t1; +LOG: pg_hint_plan: +used hint: +not used hint: +Parallel(s1.t1 5 hard) +duplication hint: +error hint: + + QUERY PLAN +---------------- + Seq Scan on t1 +(1 row) + +/*+Parallel(s1.t1 5 hard)*/ +EXPLAIN (COSTS false) SELECT * FROM s1.t1 as t11, s1.t1 as t12; +LOG: pg_hint_plan: +used hint: +not used hint: +Parallel(s1.t1 5 hard) +duplication hint: +error hint: + + QUERY PLAN +-------------------------------- + Nested Loop + -> Seq Scan on t1 t11 + -> Materialize + -> Seq Scan on t1 t12 +(4 rows) + SET parallel_setup_cost to 0; SET parallel_tuple_cost to 0; SET min_parallel_table_scan_size to 0; diff --git a/sql/ut-W.sql b/sql/ut-W.sql index 6db60f22ab46..c0e2fbc0aaeb 100644 --- a/sql/ut-W.sql +++ b/sql/ut-W.sql @@ -6,6 +6,12 @@ SET client_min_messages TO LOG; -- Queries on ordinary tables with default setting EXPLAIN (COSTS false) SELECT * FROM s1.t1; +-- Note that parallel is not enforced on a single relation without +-- the GUCs related to parallelism reset. +/*+Parallel(s1.t1 5 hard)*/ +EXPLAIN (COSTS false) SELECT * FROM s1.t1; +/*+Parallel(s1.t1 5 hard)*/ +EXPLAIN (COSTS false) SELECT * FROM s1.t1 as t11, s1.t1 as t12; SET parallel_setup_cost to 0; SET parallel_tuple_cost to 0;