Re: Bug in row_number() optimization

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, David Rowley <drowley(at)postgresql(dot)org>
Subject: Re: Bug in row_number() optimization
Date: 2022-11-25 03:00:27
Message-ID: CAMbWs4-8UnEWbb8t-mqD0oSSUF_6eK7++BkzaEED8kCvN7g90Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 25, 2022 at 7:34 AM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:

> Since upper-level WindowAggs cannot reference values calculated in
> some lower-level WindowAgg, why can't we just NULLify the pointers
> instead? See attached.

Verified the problem is fixed with this patch. I'm not familiar with
the WindowAgg execution codes. As far as I understand, this patch works
because we set ecxt_aggnulls to true, making it a NULL value. And the
top-level WindowAgg node's "Filter" is strict so that it can filter out
all the tuples that don't match the intermediate WindowAgg node's run
condition. So I find the comments about "WindowAggs above us cannot
reference the result of another WindowAgg" confusing. But maybe I'm
missing something.

Thanks
Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2022-11-25 03:19:19 Re: Patch: Global Unique Index
Previous Message Peter Smith 2022-11-25 02:53:37 Re: Perform streaming logical transactions by background workers and parallel apply