Re: Qual push down to table AM

From: Andres Freund <andres(at)anarazel(dot)de>
To: Maxime Schoemans <maxime(dot)schoemans(at)enterprisedb(dot)com>
Cc: amitlangote09(at)gmail(dot)com, Robert Haas <robertmhaas(at)gmail(dot)com>, Julien Tachoires <julien(at)tachoires(dot)me>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Qual push down to table AM
Date: 2025-12-18 19:49:49
Message-ID: 233hkumnvbdg3a5aqzyzmjkfar4eus6hlpfbqattfmeftdzdej@tpdmwzo22n43
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2025-12-18 20:40:31 +0100, Maxime Schoemans wrote:
> > On 10 Dec 2025, at 00:08, Andres Freund <andres(at)anarazel(dot)de> wrote:
> > I don't really see this being viable without first tackling two nontrivial
> > projects:
> >
> > 2) Perform ScanKey evaluation in slot form, to be able to cache the deforming
> > and to make deforming of multiple columns sufficiently efficient.
>
> Am I right in understanding that you think that the repeated calls to
> heap_getattr in HeapKeyTest is not ideal if we have NULL or varlena
> columns?

That's part of it, but not all of it: The other aspect is that if you do a
bunch of heap_getattr()s inside HeapKeyTest() and then project that column in
nodeSeqscan.c, you'll do the work to deform twice.

> > 1) Make slot deforming for expressions & projections selective, i.e. don't
> > deform all the leading columns, but only ones that will eventually be
> > needed
>
>
> Concerning 1), I’m also not certain I understand why this is a prerequisite
> for the pushdown work. It could certainly be beneficial, but it seems to be
> complementary.

As hinted at in [1] I suspect that you're just not going to see big enough
wins without the above optimization. A decent portion of the win from using
HeapKeyTest is to only selectively deform.

Greetings,

Andres Freund

[1] https://postgr.es/m/CAAh00EQUwG5khqJO7nSV0nsqsG1OP%3DkA6ACfxV3rnNSVd4b6TQ%40mail.gmail.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rahila Syed 2025-12-18 19:54:42 Re: Enhancing Memory Context Statistics Reporting
Previous Message Masahiko Sawada 2025-12-18 19:42:18 Re: Assertion failure in SnapBuildInitialSnapshot()