Re: Bug in row_number() optimization
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Sergey Shinderuk <s.shinderuk@postgrespro.ru>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>,
David Rowley <drowley@postgresql.org>
Date: 2022-11-25T03:00:27Z
Lists: pgsql-hackers
On Fri, Nov 25, 2022 at 7:34 AM David Rowley <dgrowleyml@gmail.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
Commits
-
Fix 32-bit build dangling pointer issue in WindowAgg
- 2a535620cec5 15.2 landed
- a8583272218a 16.0 landed
-
Teach planner and executor about monotonic window funcs
- 9d9c02ccd1ae 15.0 cited