Thread: Mark btree_gist functions as PARALLEL SAFE

Mark btree_gist functions as PARALLEL SAFE

From
"Winfield, Steven"
Date:
Hi,

On the back of this thread[1] over at pgsql-general, I've attached a patch that marks the functions in btree_gist as
PARALLELSAFE.
 
This is primarily to allow parallel plans to be considered when btree_gist's <-> operator is used in any context; for
examplein an expression
 
that will be evaluated at execution time, or in a functional column in btree or gist indexes.

In the latter example, despite the functions already being marked IMMUTABLE, attempts to retrieve precomputed values
froma functional index during an index scan or index-only scan still require the function to be marked PARALLEL SAFE to
preventdropping down to a serial plan.
 

It requires btree_gist's version to be bumped to 1.6.

In line with this commit[2], and for the same reasons, all functions defined by btree_gist are being marked as safe:

---

"... Note that some of the markings added by this commit don't have any
effect; for example, gseg_picksplit() isn't likely to be mentioned
explicitly in a query and therefore it's parallel-safety marking will
never be consulted.  But this commit just marks everything for
consistency: if it were somehow used in a query, that would be fine as
far as parallel query is concerned, since it does not consult any
backend-private state, attempt to write data, etc."

---

I haven't added any more tests, but neither did I find any added with the above commit.

"CREATE EXTENSION btree_gist" runs successfully, as does "make check-world".

This is the first patch I've submitted, so if I've omitted something then please let me know.
Thanks for your time,
Steven.


[1]
https://www.postgresql.org/message-id/DB7PR09MB2537E18FF90C1C1BBF49D628FD830%40DB7PR09MB2537.eurprd09.prod.outlook.com
[2] https://github.com/postgres/postgres/commit/2910fc8239fa501b662c5459d7ba16a4bc35e7e8


(Apologies if my company's footer appears here)

** Cantab Capital Partners LLP is now named GAM Systematic LLP. Please note that our email addresses have changed from
@cantabcapital.comto @gam.com.**
 

This email was sent by and on behalf of GAM Investments. GAM Investments is the corporate brand for GAM Holding AG and
itsdirect and indirect subsidiaries. These companies may be referred to as ‘GAM’ or ‘GAM Investments’. In the United
Kingdom,the business of GAM Investments is conducted by GAM (U.K.) Limited (No. 01664573) or one or more entities under
thecontrol of GAM (U.K.) Limited, including the following entities authorised and regulated by the Financial Conduct
Authority:GAM International Management Limited (No. 01802911), GAM London Limited (No. 00874802), GAM Sterling
ManagementLimited (No. 01750352), GAM Unit Trust Management Company Limited (No. 2873560) and GAM Systematic LLP (No.
OC317557).GAM (U.K.) Limited and its regulated entities are registered in England and Wales. The registered office and
principalplace of business of GAM (U.K.) Limited and its regulated entities is at 8 Finsbury Circus, London, England,
EC2M7GB. The registered office of GAM Systematic LLP is at City House, Hills Road, Cambridge, CB2 1RE. This email, and
anyattachments, is confidential and may be privileged or otherwise protected from disclosure. It is intended solely for
thestated addressee(s) and access to it by any other person is unauthorised. If you are not the intended recipient, you
mustnot disclose, copy, circulate or in any other way use or rely on the information contained herein. If you have
receivedthis email in error, please inform us immediately and delete all copies of it. See -
https://www.gam.com/en/legal/email-disclosures-eu/for further information on confidentiality, the risks of non-secure
electroniccommunication, and certain disclosures which we are required to make in accordance with applicable
legislationand regulations. If you cannot access this link, please notify us by reply message and we will send the
contentsto you. GAM Investments will collect and use information about you in the course of your interactions with us.
Fulldetails about the data types we collect and what we use this for and your related rights is set out in our online
privacypolicy at https://www.gam.com/en/legal/privacy-policy. Please familiarise yourself with this policy and check it
fromtime to time for updates as it supplements this notice.
 

Attachment

Re: Mark btree_gist functions as PARALLEL SAFE

From
Tom Lane
Date:
"Winfield, Steven" <Steven.Winfield@gam.com> writes:
> On the back of this thread[1] over at pgsql-general, I've attached a patch that marks the functions in btree_gist as
PARALLELSAFE. 

Cool, please add this patch to the commitfest queue to make sure we
don't lose track of it:

https://commitfest.postgresql.org/28/

(You'll need to have a community-website login if you don't already)

            regards, tom lane



Re: Mark btree_gist functions as PARALLEL SAFE

From
"Winfield, Steven"
Date:
Done - thanks again.

Steven.

From: Tom Lane <tgl@sss.pgh.pa.us>
Sent: 18 June 2020 16:28
To: Winfield, Steven <Steven.Winfield@gam.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: Re: Mark btree_gist functions as PARALLEL SAFE
 
"Winfield, Steven" <Steven.Winfield@gam.com> writes:
> On the back of this thread[1] over at pgsql-general, I've attached a patch that marks the functions in btree_gist as PARALLEL SAFE.

Cool, please add this patch to the commitfest queue to make sure we
don't lose track of it:

https://urldefense.proofpoint.com/v2/url?u=https-3A__commitfest.postgresql.org_28_&d=DwIFAg&c=55O-mPK0zNHOMgGDdj4__Q&r=JVb896wEUUvWD7VB-jCoEHWXWQRzU6xqZ3aOcIepVzQ&m=oE70Ndze7YukhfkcIi70pjHsKB2zAgJuNkcyEXLkSso&s=G4QLL-xXQrC_txQXOnZGH8bD5kq6sOPh5BY-DyWA9fw&e=

(You'll need to have a community-website login if you don't already)

                        regards, tom lane

** Cantab Capital Partners LLP is now named GAM Systematic LLP. Please note that our email addresses have changed from @cantabcapital.com to @gam.com.**

This email was sent by and on behalf of GAM Investments. GAM Investments is the corporate brand for GAM Holding AG and its direct and indirect subsidiaries. These companies may be referred to as ‘GAM’ or ‘GAM Investments’. In the United Kingdom, the business of GAM Investments is conducted by GAM (U.K.) Limited (No. 01664573) or one or more entities under the control of GAM (U.K.) Limited, including the following entities authorised and regulated by the Financial Conduct Authority: GAM International Management Limited (No. 01802911), GAM London Limited (No. 00874802), GAM Sterling Management Limited (No. 01750352), GAM Unit Trust Management Company Limited (No. 2873560) and GAM Systematic LLP (No. OC317557). GAM (U.K.) Limited and its regulated entities are registered in England and Wales. The registered office and principal place of business of GAM (U.K.) Limited and its regulated entities is at 8 Finsbury Circus, London, England, EC2M 7GB. The registered office of GAM Systematic LLP is at City House, Hills Road, Cambridge, CB2 1RE. This email, and any attachments, is confidential and may be privileged or otherwise protected from disclosure. It is intended solely for the stated addressee(s) and access to it by any other person is unauthorised. If you are not the intended recipient, you must not disclose, copy, circulate or in any other way use or rely on the information contained herein. If you have received this email in error, please inform us immediately and delete all copies of it. See - https://www.gam.com/en/legal/email-disclosures-eu/ for further information on confidentiality, the risks of non-secure electronic communication, and certain disclosures which we are required to make in accordance with applicable legislation and regulations. If you cannot access this link, please notify us by reply message and we will send the contents to you. GAM Investments will collect and use information about you in the course of your interactions with us. Full details about the data types we collect and what we use this for and your related rights is set out in our online privacy policy at https://www.gam.com/en/legal/privacy-policy. Please familiarise yourself with this policy and check it from time to time for updates as it supplements this notice.

Re: Mark btree_gist functions as PARALLEL SAFE

From
Alexander Korotkov
Date:
On Thu, Jun 18, 2020 at 7:48 PM Winfield, Steven
<Steven.Winfield@gam.com> wrote:
> Done - thanks again.

This patch looks good to me.

I've rechecked it marks all the functions as parallel safe by
installing an extension and querying the catalog.  I've also rechecked
that there is nothing suspicious in these functions in terms of
parallel safety.  I did just minor adjustments in migration script
comments.

I'm going to push this if no objections.

------
Regards,
Alexander Korotkov

Attachment

Re: Mark btree_gist functions as PARALLEL SAFE

From
Justin Pryzby
Date:
On Wed, Jul 15, 2020 at 03:26:24PM +0300, Alexander Korotkov wrote:
> On Thu, Jun 18, 2020 at 7:48 PM Winfield, Steven
> <Steven.Winfield@gam.com> wrote:
> > Done - thanks again.
> 
> This patch looks good to me.
> 
> I'm going to push this if no objections.

I marked as committed to make patch checker look healthier.

Thanks,
-- 
Justin



Re: Mark btree_gist functions as PARALLEL SAFE

From
Alexander Korotkov
Date:
On Mon, Jul 20, 2020 at 3:18 PM Justin Pryzby <pryzby@telsasoft.com> wrote:
On Wed, Jul 15, 2020 at 03:26:24PM +0300, Alexander Korotkov wrote:
> On Thu, Jun 18, 2020 at 7:48 PM Winfield, Steven
> <Steven.Winfield@gam.com> wrote:
> > Done - thanks again.
>
> This patch looks good to me.
>
> I'm going to push this if no objections.

I marked as committed to make patch checker look healthier.

Thank you!

------
Regards,
Alexander Korotkov