Re: pgstatindex vs. !indisready

From: Noah Misch <noah(at)leadboat(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pgstatindex vs. !indisready
Date: 2023-10-22 21:02:45
Message-ID: 20231022210245.2f.nmisch@google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 04, 2023 at 09:00:23AM +0900, Michael Paquier wrote:
> On Sun, Oct 01, 2023 at 06:31:26PM -0700, Noah Misch wrote:
> > The !indisvalid index may be missing tuples, yes. In what way does that make
> > one of those four operations incorrect?
>
> Reminding myself of what these four do, it looks that you're right and
> that the state of indisvalid is not going to change what they report.
>
> Still, I'd like to agree with Tom's point to be more conservative and
> check also for indisvalid which is what the planner does. These
> functions will be used in SELECTs, and one thing that worries me is
> that checks based on indisready may get copy-pasted somewhere else,
> leading to incorrect results where they get copied. (indisready &&
> !indisvalid) is a "short"-term combination in a concurrent build
> process, as well (depends on how long one waits for the old snapshots
> before switching indisvalid, but that's way shorter than the period of
> time where the built indexes remain valid).

Neither choice would harm the user experience in an important way, so I've
followed your preference in the attached patch.

Attachment Content-Type Size
indisvalid-funcs-v1.patch text/plain 6.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2023-10-23 00:00:00 Re: SQL:2011 application time
Previous Message Andres Freund 2023-10-22 19:24:58 Re: Guiding principle for dropping LLVM versions?