Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

From: Oliver Ford <ojford(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: vik(at)postgresfriends(dot)org, pgsql-hackers(at)postgresql(dot)org, tgl(at)sss(dot)pgh(dot)pa(dot)us, andrew(at)tao11(dot)riddles(dot)org(dot)uk, david(at)fetter(dot)org, krasiyan(at)gmail(dot)com
Subject: Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options
Date: 2025-01-17 16:43:29
Message-ID: CAGMVOduHcfhh7Wo9W1Tff0DH_ccPuQGc8D_f5S2_y4OHFOjn=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 12, 2024 at 2:41 AM Tatsuo Ishii <ishii(at)postgresql(dot)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 Content-Type Size
0003-ignore-nulls.patch application/octet-stream 42.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2025-01-17 17:13:08 Re: Parallel heap vacuum
Previous Message Laurenz Albe 2025-01-17 16:43:13 Re: Fwd: Re: proposal: schema variables