Re: [PATCH] Negative Transition Aggregate Functions (WIP) - Mailing list pgsql-hackers

From David Rowley
Subject Re: [PATCH] Negative Transition Aggregate Functions (WIP)
Date
Msg-id CAApHDvpXMXM8d3ufteuWfc7+0Rt_O1D3-NsU8Zs8jMDjdvVLmg@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Negative Transition Aggregate Functions (WIP)  (Florian Pflug <fgp@phlo.org>)
Responses Re: [PATCH] Negative Transition Aggregate Functions (WIP)  (Florian Pflug <fgp@phlo.org>)
List pgsql-hackers

bool_or()
  FALSE can be removed, removing TRUE requires a rescan. Could be made
  fully invertible by counting the number of TRUE and FALSE values,
  similar to my suggestion for how to handle NaN for sum(numeric).
  Same works for bool_and().

bit_or()
  Like boo_or(), 0 can be removed, everything else requires a rescan.
  Same works for bit_and()


Interesting, I'd not thought of any way to optimise these ones, but I had originally thought about allowing the inverse transition functions to report if they could perform the inverse transition based on the value they received and if they reported failure, then perform the rescan.
I just don't quite know yet the base way for the inverse transition function to communicate this to the caller yet. If you have any ideas on the best way to do this then I'd really like to hear them.

Regards

David Rowley

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: [PATCH] Negative Transition Aggregate Functions (WIP)
Next
From: Marko Tiikkaja
Date:
Subject: Re: array_length(anyarray)