Mark btree_gist functions as PARALLEL SAFE - Mailing list pgsql-hackers

From Winfield, Steven
Subject Mark btree_gist functions as PARALLEL SAFE
Date
Msg-id AM5PR0901MB1587E47B1ACF23C6089DFCA3FD9B0@AM5PR0901MB1587.eurprd09.prod.outlook.com
Whole thread Raw
Responses Re: Mark btree_gist functions as PARALLEL SAFE
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: Cleanup - Removal of unused function parameter from CopyReadBinaryAttribute
Next
From: Robert Haas
Date:
Subject: Re: [Patch] ALTER SYSTEM READ ONLY