Re: Bug in row_number() optimization

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Guo <guofenglinux(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, David Rowley <drowley(at)postgresql(dot)org>
Subject: Re: Bug in row_number() optimization
Date: 2022-12-05 04:16:53
Message-ID: CAApHDvrDteMo9N5am94ytNSJ2PYBsUmp3qCdXSWkjp261EggJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 28 Nov 2022 at 22:59, Sergey Shinderuk
<s(dot)shinderuk(at)postgrespro(dot)ru> wrote:
>
> On 28.11.2022 03:23, David Rowley wrote:
> > On Sat, 26 Nov 2022 at 05:19, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> It's pretty unlikely that this would work during an actual index scan.
> >> I'm fairly sure that btree (and other index AMs) have hard-wired
> >> assumptions that index operators are strict.
> >
> > If we're worried about that then we could just restrict this
> > optimization to only work with strict quals.
>
> Not sure this is necessary if btree operators must be strict anyway.

I'd rather see the func_strict() test in there. You've already
demonstrated you can get wrong results with a non-strict operator. I'm
not disputing that it sounds like a broken operator class or not. I
just want to ensure we don't leave any holes open for this
optimisation to return incorrect results.

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-12-05 04:27:57 Re: Optimize common expressions in projection evaluation
Previous Message Michael Paquier 2022-12-05 04:13:23 Re: Add LSN along with offset to error messages reported for WAL file read/write/validate header failures