From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | Amit Langote <amitlangote09(at)gmail(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com> |
Cc: | Seamus Abshere <seamus(at)abshere(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: A reloption for partitioned tables - parallel_workers |
Date: | 2021-03-01 15:10:26 |
Message-ID: | 6ea74a9ae2d8d0175a8bd3268353eb175e2b3bc7.camel@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, 2021-03-01 at 17:39 +0900, Amit Langote wrote:
> > 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 ?
>
> Oh, you're right. The parallel_workers setting of a relation is only
> accessed through this macro, even for partitioned tables, and I can
> see that it is actually wrong to access a partitioned table's
> parallel_workers through this macro as-is. Although I hadn't tested
> that, so thanks for pointing that out.
>
> > Like:
> > #define PartitionedTableGetParallelWorkers(relation, defaultpw) \
> > xxx
> > (PartitionedTableRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw))
>
> I'm thinking it would be better to just modify the existing macro to
> check relkind to decide which struct pointer type to cast the value in
> rd_options to.
Here is an updated patch with this fix.
I added regression tests and adapted the documentation a bit.
I also added support for lowering the number of parallel workers.
Yours,
Laurenz Albe
Attachment | Content-Type | Size |
---|---|---|
v3-0001-Allow-setting-parallel_workers-on-partitioned-tab.patch | text/x-patch | 15.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Dilip Kumar | 2021-03-01 15:23:09 | Re: [HACKERS] Custom compression methods |
Previous Message | Tom Lane | 2021-03-01 14:44:27 | Re: macOS SIP, next try |