diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index c5f6593..daaefdc 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -122,6 +122,7 @@ Cost disable_cost = 1.0e10; int max_parallel_workers_per_gather = 2; bool enable_seqscan = true; +bool enable_singleseqscan = true; bool enable_indexscan = true; bool enable_indexonlyscan = true; bool enable_bitmapscan = true; @@ -231,6 +232,9 @@ cost_seqscan(Path *path, PlannerInfo *root, if (!enable_seqscan) startup_cost += disable_cost; + if (!enable_singleseqscan && path->parallel_workers==0) + startup_cost += disable_cost; + /* fetch estimated page cost for tablespace containing table */ get_tablespace_page_costs(baserel->reltablespace, NULL, diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index ba74bf9..df22e08 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -898,6 +898,16 @@ static struct config_bool ConfigureNamesBool[] = NULL, NULL, NULL }, { + {"enable_singleseqscan", PGC_USERSET, QUERY_TUNING_METHOD, + gettext_noop("Enables the planner's use of non-parallel sequential-scan plans."), + NULL, + GUC_EXPLAIN + }, + &enable_singleseqscan, + true, + NULL, NULL, NULL + }, + { {"enable_indexscan", PGC_USERSET, QUERY_TUNING_METHOD, gettext_noop("Enables the planner's use of index-scan plans."), NULL, diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index b3d0b4f..79ce31d 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -48,6 +48,7 @@ typedef enum extern PGDLLIMPORT Cost disable_cost; extern PGDLLIMPORT int max_parallel_workers_per_gather; extern PGDLLIMPORT bool enable_seqscan; +extern PGDLLIMPORT bool enable_singleseqscan; extern PGDLLIMPORT bool enable_indexscan; extern PGDLLIMPORT bool enable_indexonlyscan; extern PGDLLIMPORT bool enable_bitmapscan; diff --git a/src/test/regress/expected/sysviews.out b/src/test/regress/expected/sysviews.out index a1c90eb..8389cf9 100644 --- a/src/test/regress/expected/sysviews.out +++ b/src/test/regress/expected/sysviews.out @@ -87,9 +87,10 @@ select name, setting from pg_settings where name like 'enable%'; enable_partitionwise_aggregate | off enable_partitionwise_join | off enable_seqscan | on + enable_singleseqscan | on enable_sort | on enable_tidscan | on -(17 rows) +(18 rows) -- Test that the pg_timezone_names and pg_timezone_abbrevs views are -- more-or-less working. We can't test their contents in any great detail