Re: avg,first,last,median in one query - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: avg,first,last,median in one query
Date
Msg-id 56F4A2A8.4080901@BlueTreble.com
Whole thread Raw
In response to avg,first,last,median in one query  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
List pgsql-hackers
On 3/24/16 9:00 AM, Konstantin Knizhnik wrote:
> But unfortunately it is not possible to calculate median is such way
> because percentile_disc is not compatible with OVER:

I don't know if you could use cume_dist()[1] to do this, but even if you 
can't it probably wouldn't be hard to modify it to do what you need.

[1] http://www.postgresql.org/docs/9.5/static/functions-window.html
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: Alter or rename enum value
Next
From: Stephen Frost
Date:
Subject: Re: Show dropped users' backends in pg_stat_activity