median and percentile function implementation

Started by Pavel Stehuleover 12 years ago4 messageshackers
Jump to latest
#1Pavel Stehule
pavel.stehule@gmail.com

Hello

Three years ago we worked on implementation of median function.

/messages/by-id/AANLkTimRksUOgGsK7-gTXnvJJGL-1QvuqxidusZQwep6@mail.gmail.com

Can we implement this function now?

There are a few opened questions:

* immutable parameters of aggregate functions

* effective implementation when data are in memory

* effective implementation when data are out of memory

* effective implementation for usage as window function - running median.

Better than before, we can choose between hashing and sorting based
aggregation. But tuplesort implementation is not right for using as window
function. Second issue can be a not possible reusing of tuplesort for more
final functions - median, percentile in one query.

Ideas how to solve this task? Can we move forward in some points?

Regards

Pavel

#2Vik Fearing
vik@postgresfriends.org
In reply to: Pavel Stehule (#1)
Re: median and percentile function implementation

On 08/26/2013 02:39 PM, Pavel Stehule wrote:

Hello

Three years ago we worked on implementation of median function.

/messages/by-id/AANLkTimRksUOgGsK7-gTXnvJJGL-1QvuqxidusZQwep6@mail.gmail.com

Can we implement this function now?

There are a few opened questions:

* immutable parameters of aggregate functions

* effective implementation when data are in memory

* effective implementation when data are out of memory

* effective implementation for usage as window function - running median.

Better than before, we can choose between hashing and sorting based
aggregation. But tuplesort implementation is not right for using as
window function. Second issue can be a not possible reusing of
tuplesort for more final functions - median, percentile in one query.

Ideas how to solve this task? Can we move forward in some points?

Take a look at the standard-compliant WITHIN GROUP that is currently in
development for 9.4.
/messages/by-id/2b8b55b8ba82f83ef4e6070b95fb0cd0@news-out.riddles.org.uk

--
Vik

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Pavel Stehule
pavel.stehule@gmail.com
In reply to: Vik Fearing (#2)
Re: median and percentile function implementation

Hello

very nice! I tested it and works very well.

And I looking for implementation in core.

Two notes:

* should to support string_agg and array_agg

Regards

Pavel

2013/8/26 Vik Fearing <vik.fearing@dalibo.com>

Show quoted text

On 08/26/2013 02:39 PM, Pavel Stehule wrote:

Hello

Three years ago we worked on implementation of median function.

/messages/by-id/AANLkTimRksUOgGsK7-gTXnvJJGL-1QvuqxidusZQwep6@mail.gmail.com

Can we implement this function now?

There are a few opened questions:

* immutable parameters of aggregate functions

* effective implementation when data are in memory

* effective implementation when data are out of memory

* effective implementation for usage as window function - running median.

Better than before, we can choose between hashing and sorting based
aggregation. But tuplesort implementation is not right for using as
window function. Second issue can be a not possible reusing of
tuplesort for more final functions - median, percentile in one query.

Ideas how to solve this task? Can we move forward in some points?

Take a look at the standard-compliant WITHIN GROUP that is currently in
development for 9.4.

/messages/by-id/2b8b55b8ba82f83ef4e6070b95fb0cd0@news-out.riddles.org.uk

--
Vik

#4Atri Sharma
atri.jiit@gmail.com
In reply to: Pavel Stehule (#3)
Re: median and percentile function implementation

On Mon, Aug 26, 2013 at 10:15 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:

Hello

very nice! I tested it and works very well.

And I looking for implementation in core.

Two notes:

* should to support string_agg and array_agg

Regards

Pavel

2013/8/26 Vik Fearing <vik.fearing@dalibo.com>

On 08/26/2013 02:39 PM, Pavel Stehule wrote:

Hello

Three years ago we worked on implementation of median function.

/messages/by-id/AANLkTimRksUOgGsK7-gTXnvJJGL-1QvuqxidusZQwep6@mail.gmail.com

Can we implement this function now?

There are a few opened questions:

* immutable parameters of aggregate functions

* effective implementation when data are in memory

* effective implementation when data are out of memory

* effective implementation for usage as window function - running
median.

Better than before, we can choose between hashing and sorting based
aggregation. But tuplesort implementation is not right for using as
window function. Second issue can be a not possible reusing of
tuplesort for more final functions - median, percentile in one query.

Ideas how to solve this task? Can we move forward in some points?

Take a look at the standard-compliant WITHIN GROUP that is currently in
development for 9.4.

/messages/by-id/2b8b55b8ba82f83ef4e6070b95fb0cd0@news-out.riddles.org.uk

--
Vik

Thanks a ton!

We will definitely look at supporting at the two functions you mentioned.

Regards,

Atri

--
Regards,

Atri
l'apprenant

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers