Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Nicholas White <n(dot)j(dot)white(at)gmail(dot)com>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Troels Nielsen <bn(dot)troels(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls
Date: 2013-07-05 21:33:40
Message-ID: 1373060020.7056.22.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2013-07-01 at 07:40 -0400, Robert Haas wrote:
> On Sun, Jun 30, 2013 at 10:07 PM, Nicholas White <n(dot)j(dot)white(at)gmail(dot)com> wrote:
> > I've attached another iteration of the patch that fixes the multiple-window
> > bug and adds (& uses) a function to create a Bitmapset using a custom
> > allocator. I don't think there's any outstanding problems with it now.
>
> I think the right way to do this is to temporarily set the current
> memory context to winobj->winstate->partcontext while creating or
> manipulating the Bitmapset and restore it afterwards. Maybe someone
> will say that's a modularity violation, but surely this is worse...

I think we should get rid of the bitmapset entirely. For one thing, we
want to be able to support large frames, and the size of the allocation
for the bitmap is dependent on the size of the frame. It would take a
very large frame for that to matter, but conceptually, it doesn't seem
right to me.

Instead of the bitmapset, we can keep track of two offsets, and the
number of rows in between which are non-NULL. That only works with a
constant offset; but I'm not inclined to optimize for the special case
involving large frames, variable offset which always happens to be
large, and IGNORE NULLS.

Regards,
Jeff Davis

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2013-07-05 21:34:10 Re: [9.4 CF 1] The Commitfest Slacker List
Previous Message Tom Lane 2013-07-05 20:40:47 Re: sepgsql and materialized views