diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 379fc5c..138b72b 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -1339,8 +1339,9 @@ ExplainNode(PlanState *planstate, List *ancestors, if (plan->qual) show_instrumentation_count("Rows Removed by Filter", 1, planstate, es); - ExplainPropertyInteger("Workers Planned", - gather->num_workers, es); + if (es->costs) + ExplainPropertyInteger("Workers Planned", + gather->num_workers, es); if (es->analyze) { int nworkers; diff --git a/src/test/regress/expected/select_parallel.out b/src/test/regress/expected/select_parallel.out new file mode 100644 index 0000000..cb8a4cb --- /dev/null +++ b/src/test/regress/expected/select_parallel.out @@ -0,0 +1,30 @@ +-- +-- PARALLEL +-- +-- setup parallel test +create unlogged table tenk_parallel as table tenk1 with no data; +set parallel_setup_cost=0; +set parallel_tuple_cost=0; +-- create a table with enough data to trigger parallel behavior +insert into tenk_parallel + select tenk1.* from tenk1, generate_series(0,2); +explain (costs off) + select count(*) from tenk_parallel; + QUERY PLAN +------------------------------------------------------ + Finalize Aggregate + -> Gather + -> Partial Aggregate + -> Parallel Seq Scan on tenk_parallel +(4 rows) + +select count(*) from tenk_parallel; + count +------- + 30000 +(1 row) + +-- cleanup +drop table tenk_parallel; +set parallel_setup_cost to default; +set parallel_tuple_cost to default; diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule index c03f635..7fbb72f 100644 --- a/src/test/regress/parallel_schedule +++ b/src/test/regress/parallel_schedule @@ -79,7 +79,7 @@ ignore: random # ---------- # Another group of parallel tests # ---------- -test: select_into select_distinct select_distinct_on select_implicit select_having subselect union case join aggregates transactions random portals arrays btree_index hash_index update namespace prepared_xacts delete +test: select_into select_distinct select_distinct_on select_implicit select_having subselect union case join aggregates transactions random portals arrays btree_index hash_index update namespace prepared_xacts delete select_parallel # ---------- # Another group of parallel tests diff --git a/src/test/regress/sql/select_parallel.sql b/src/test/regress/sql/select_parallel.sql new file mode 100644 index 0000000..f2426fc --- /dev/null +++ b/src/test/regress/sql/select_parallel.sql @@ -0,0 +1,22 @@ +-- +-- PARALLEL +-- + +-- setup parallel test +create unlogged table tenk_parallel as table tenk1 with no data; +set parallel_setup_cost=0; +set parallel_tuple_cost=0; + +-- create a table with enough data to trigger parallel behavior +insert into tenk_parallel + select tenk1.* from tenk1, generate_series(0,2); + +explain (costs off) + select count(*) from tenk_parallel; +select count(*) from tenk_parallel; + +-- cleanup +drop table tenk_parallel; +set parallel_setup_cost to default; +set parallel_tuple_cost to default; +