Re: avg,first,last,median in one query

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: avg,first,last,median in one query
Date: 2016-03-25 02:30:00
Message-ID: 56F4A2A8.4080901@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2016-03-25 02:33:47 Re: Show dropped users' backends in pg_stat_activity
Previous Message Jim Nasby 2016-03-25 02:05:44 Re: Alter or rename enum value