pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: jian he <jian.universality@gmail.com>
Cc: Tender Wang <tndrwang@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org, Alexander Lakhin <exclusion@gmail.com>
Subject: Re: BUG #18314: PARALLEL UNSAFE function does not prevent parallel index build
Date: Wed, 6 Mar 2024 07:45:21 +0900
Message-ID: <ZeeggQxKb8uBLV35@paquier.xyz> (raw)
In-Reply-To: <CACJufxEQGsCqsa2XZMQdHtZxwBD8tncLDJV32+6G9y4bOi0jVg@mail.gmail.com>
References: <CAHewXNkSYVYktt0KW8RtfNMDYi4Stn7OJtuTqeo+c3He1xoFXQ@mail.gmail.com>
	<CACJufxFFmFKeLBgQfwyGCEoTyEoksXgbJ0uWc=whPu5fk=LXwA@mail.gmail.com>
	<CACJufxEGcGYg62qMzfkkx_0v5QWvM-vMwz9166hDpV8Emi0OZw@mail.gmail.com>
	<CACJufxGG=sjUSQnWOcYz+rhdGaP9OdfrEGa2K1d8krGuUn5B4w@mail.gmail.com>
	<CACJufxHYMSt-irv+unpoAN76WDKzSRxzwOALG3ares52Lvtuug@mail.gmail.com>
	<CAHewXN=vHTbjdUmz8roJFN4MkO6hhGksve06wfpCAykz-F2WTQ@mail.gmail.com>
	<CACJufxFzy4A8Pbk-TtVa1+cjx9Kf09m+7EOEAYwN0ex4mZEjSA@mail.gmail.com>
	<ZeaVK_J8b29Gxv_P@paquier.xyz>
	<CAHewXNnepBeJ5kBCpF6GFh6yxChXWjNEVMRTP+1KYJCMS+Ks_w@mail.gmail.com>
	<CACJufxEQGsCqsa2XZMQdHtZxwBD8tncLDJV32+6G9y4bOi0jVg@mail.gmail.com>

On Tue, Mar 05, 2024 at 09:22:08PM +0800, jian he wrote:
> in RelationGetIndexClause to, I think you can use the following to
> save a SearchSysCache1 cycle?
> if (relation->rd_indextuple == NULL ||
> heap_attisnull(relation->rd_indextuple, Anum_pg_index_indexprs, NULL))
> return NIL;
> 
> or
> if (relation->rd_indextuple == NULL ||
> heap_attisnull(relation->rd_indextuple, Anum_pg_index_indpred, NULL))
> return NIL;

Don't think so.  The point is to not rely on the relcache at all to
retrieve this information.

> main question would be why not two functions,
> like RelationGetIndexRawExpr(Relation relation),
> RelationGetIndexRawPred(Relation relation)

This comes down to if it is clean to have references to the catalog
pg_index in the planner, which is not the case yet so my take is that
two functions is much cleaner even if both return a List.

Anyway, why do you insist in putting the new functions in relcache.c?
I would suggest to move that to lsyscache.c instead, close to
get_index_column_opclass where there are routines for the syscache of
pg_index.  It would be possible to reuse that in the reindex code, for
example.

The patch should add a comment in in plan_create_index_workers()
explaining why we care about raw expressions and indexes rather than
the relcache information.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (21+ messages)  latest in thread

Message-ID: <ZeeggQxKb8uBLV35@paquier.xyz>
Permalink:  ../ZeeggQxKb8uBLV35@paquier.xyz/
Also on:    postgresql.org/message-id/ZeeggQxKb8uBLV35@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, jian.universality@gmail.com, tndrwang@gmail.com, exclusion@gmail.com
  Subject: Re: BUG #18314: PARALLEL UNSAFE function does not prevent parallel index build
  In-Reply-To: <ZeeggQxKb8uBLV35@paquier.xyz>
  References: <CAHewXNkSYVYktt0KW8RtfNMDYi4Stn7OJtuTqeo+c3He1xoFXQ@mail.gmail.com> <CACJufxFFmFKeLBgQfwyGCEoTyEoksXgbJ0uWc=whPu5fk=LXwA@mail.gmail.com> <CACJufxEGcGYg62qMzfkkx_0v5QWvM-vMwz9166hDpV8Emi0OZw@mail.gmail.com> <CACJufxGG=sjUSQnWOcYz+rhdGaP9OdfrEGa2K1d8krGuUn5B4w@mail.gmail.com> <CACJufxHYMSt-irv+unpoAN76WDKzSRxzwOALG3ares52Lvtuug@mail.gmail.com> <CAHewXN=vHTbjdUmz8roJFN4MkO6hhGksve06wfpCAykz-F2WTQ@mail.gmail.com> <CACJufxFzy4A8Pbk-TtVa1+cjx9Kf09m+7EOEAYwN0ex4mZEjSA@mail.gmail.com> <ZeaVK_J8b29Gxv_P@paquier.xyz> <CAHewXNnepBeJ5kBCpF6GFh6yxChXWjNEVMRTP+1KYJCMS+Ks_w@mail.gmail.com> <CACJufxEQGsCqsa2XZMQdHtZxwBD8tncLDJV32+6G9y4bOi0jVg@mail.gmail.com> <ZeeggQxKb8uBLV35@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox