From: | "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com> |
---|---|
To: | Amit Langote <amitlangote09(at)gmail(dot)com> |
Cc: | Seamus Abshere <seamus(at)abshere(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
Subject: | RE: A reloption for partitioned tables - parallel_workers |
Date: | 2021-02-23 10:24:29 |
Message-ID: | OS0PR01MB571647F55A713A45924C416B94809@OS0PR01MB5716.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> > It seems the patch does not include the code that get the
> > parallel_workers from new struct " PartitionedTableRdOptions ", Did I miss
> something ?
>
> Aren't the following hunks in the v2 patch what you meant?
>
> diff --git a/src/backend/access/common/reloptions.c
> b/src/backend/access/common/reloptions.c
> index c687d3ee9e..f8443d2361 100644
> --- a/src/backend/access/common/reloptions.c
> +++ b/src/backend/access/common/reloptions.c
> @@ -377,7 +377,7 @@ static relopt_int intRelOpts[] =
> {
> "parallel_workers",
> "Number of parallel processes that can be used per executor node for this
> relation.",
> - RELOPT_KIND_HEAP,
> + RELOPT_KIND_HEAP | RELOPT_KIND_PARTITIONED,
> ShareUpdateExclusiveLock
> },
> -1, 0, 1024
> @@ -1962,12 +1962,18 @@ bytea *
> partitioned_table_reloptions(Datum reloptions, bool validate) {
> /*
> - * There are no options for partitioned tables yet, but this is able to do
> - * some validation.
> + * Currently the only setting known to be useful for partitioned tables
> + * is parallel_workers.
> */
> + static const relopt_parse_elt tab[] = { {"parallel_workers",
> + RELOPT_TYPE_INT, offsetof(PartitionedTableRdOptions,
> + parallel_workers)}, };
> +
> return (bytea *) build_reloptions(reloptions, validate,
> RELOPT_KIND_PARTITIONED,
> - 0, NULL, 0);
> + sizeof(PartitionedTableRdOptions),
> + tab, lengthof(tab));
> }
>
> /*
>
> diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index
> 10b63982c0..fe114e0856 100644
> --- a/src/include/utils/rel.h
> +++ b/src/include/utils/rel.h
> @@ -308,6 +308,16 @@ typedef struct StdRdOptions
> bool vacuum_truncate; /* enables vacuum to truncate a relation */ }
> StdRdOptions;
>
> +/*
> + * PartitionedTableRdOptions
> + * Contents of rd_options for partitioned tables */ typedef struct
> +PartitionedTableRdOptions {
> + int32 vl_len_; /* varlena header (do not touch directly!) */ int
> +parallel_workers; /* max number of parallel workers */ }
> +PartitionedTableRdOptions;
> +
> #define HEAP_MIN_FILLFACTOR 10
> #define HEAP_DEFAULT_FILLFACTOR 100
Hi,
I am not sure.
IMO, for normal table, we use the following macro to get the parallel_workers:
----------------------
/*
* RelationGetParallelWorkers
* Returns the relation's parallel_workers reloption setting.
* Note multiple eval of argument!
*/
#define RelationGetParallelWorkers(relation, defaultpw) \
((relation)->rd_options ? \
((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw))
----------------------
Since we add new struct " PartitionedTableRdOptions ", It seems we need to get parallel_workers in different way.
Do we need similar macro to get partitioned table's parallel_workers ?
Like:
#define PartitionedTableGetParallelWorkers(relation, defaultpw) \
xxx
(PartitionedTableRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw))
Best regards,
houzj
From | Date | Subject | |
---|---|---|---|
Next Message | Masahiko Sawada | 2021-02-23 11:03:31 | Re: {CREATE INDEX, REINDEX} CONCURRENTLY improvements |
Previous Message | Andres Freund | 2021-02-23 10:03:44 | Asynchronous and "direct" IO support for PostgreSQL. |