Re: lag() default value ignored for some window partition depending on table records count?

From: Loïc Revest <l(dot)revest(at)apc(dot)fr>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: lag() default value ignored for some window partition depending on table records count?
Date: 2022-04-27 15:19:30
Message-ID: CABkOrLsPtG=fgHTuTQz35RMx1jvFJ8NN1Nrvto-b4hQB8hS5oQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

>> On Wed, 27 Apr 2022 at 10:48, David G. Johnston
>> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>>
>> There can only be qual pushdown when the column in the qual is present
>> in the PARTITION BY clause. In this case, there's no PARTITION BY
>> clause, so can't be pushdowns.
>>
peer_id being only used as a sort criterion instead of the
partitioning factor is indeed the culprit, and a true shame I haven't
figured it out on my own.

lag(<value>, 1, 0::numeric) OVER (PARTITION BY peer_id ORDER BY
calculation_time) returns 0::numeric for first row in partition, as
expected.

Thanks a lot to all three of you for pointing it out to me, and my
apologies for the unrelevant noise on that list.

Regards,
L. Revest

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Julien Rouhaud 2022-04-27 16:48:41 Re: BUG #17448: In Windows 10, version 1703 and later, huge_pages doesn't work.
Previous Message Wilm Hoyer 2022-04-27 15:04:23 AW: BUG #17448: In Windows 10, version 1703 and later, huge_pages doesn't work.