Re: Index-only scans vs. partially-retrievable indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Index-only scans vs. partially-retrievable indexes
Date: 2022-01-02 23:22:23
Message-ID: 3443352.1641165743@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Unless somebody's got a better idea, I'll push forward with making
> this happen.

Here's a proposed patch for that. I ended up reverting the code
changes of 4ace45677 in favor of an alternative I'd considered
previously, which is to mark the indextlist elements as resjunk
if they're non-retrievable, and then make setrefs.c deal with
not relying on those elements. This avoids the EXPLAIN breakage
I showed, since now we still have the indextlist elements needed
to interpret the indexqual and indexorderby expressions.

0001 is what I propose to back-patch (modulo putting the new
IndexOnlyScan.recheckqual field at the end, in the back branches).

In addition, it seems to me that we can simplify check_index_only()
by reverting b5febc1d1's changes, because we've now been forced to
put in a non-half-baked solution for the problem it addressed.
That's 0002 attached. I'd be inclined not to back-patch that though.

regards, tom lane

Attachment Content-Type Size
0001-fix-lossy-indexquals-better.patch text/x-diff 16.3 KB
0002-revert-b5febc1d1.patch text/x-diff 3.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2022-01-03 01:47:05 Re: daitch_mokotoff module
Previous Message Andres Freund 2022-01-02 21:34:45 Re: Add jsonlog log_destination for JSON server logs