Skip to content

Commit

Permalink
Add test to check behavior of parallel hints under default setup
Browse files Browse the repository at this point in the history
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 yugabyte#112.

Backpatch-through: 10
  • Loading branch information
michaelpq committed Jan 10, 2023
1 parent 575288f commit 16f2cdc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
33 changes: 33 additions & 0 deletions expected/ut-W.out
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions sql/ut-W.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 16f2cdc

Please sign in to comment.