On Thu, Sep 12, 2024 at 2:41 AM Tatsuo Ishii <is...@postgresql.org> wrote:
>
> It seems you allow to use IGNORE NULLS for all window functions. If
> the case, you should explicitely stat that in the docs. Otherwise
> users will be confused because;

The latest version restricts it to lag, lead, first_value, last_value,
and nth_value. We can extend it in a subsequent patch if there's
demand?

> I take a look at the patch and noticed that following functions have
> no comments on what they are doing and what are the arguments. Please
> look into other functions in nodeWindowAgg.c and add appropriate
> comments to those functions.

Latest version has more comments and should be in the standard coding style.

> I also notice that you have an array in memory which records non-null
> row positions in a partition. The position is represented in int64,
> which means 1 entry consumes 8 bytes. If my understanding is correct,
> the array continues to grow up to the partition size. Also the array
> is created for each window function (is it really necessary?). I worry
> about this because it might consume excessive memory for big
> partitions.

It's an int64 because it stores the abs_pos/mark_pos which are int64.
Keeping an array for each function is needed for the mark optimization
to work correctly.

Attachment: 0003-ignore-nulls.patch
Description: Binary data

Reply via email to