Re: Cumulative count (running total) window fn

From: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
To: Oliver Kohll - Mailing Lists <oliver(dot)lists(at)gtwm(dot)co(dot)uk>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Thom Brown <thombrown(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Cumulative count (running total) window fn
Date: 2010-04-30 10:06:32
Message-ID: 05309593-C1F5-455B-A9F1-921097376511@solfertje.student.utwente.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 29 Apr 2010, at 19:21, Oliver Kohll - Mailing Lists wrote:

> The two plans (note I've been rewriting the field names for readability until now but haven't here):
>
> explain analyze SELECT year, sum(c) over (order by year)
> FROM (
> SELECT extract(year from a56b7a8d6de03f67b) AS year, count(a10e4ab8863c199f1) AS c
> FROM a2e9a7e9e257153de
> GROUP BY extract(year from a56b7a8d6de03f67b)
> ) as subq;

Oh my, how can you work with such column and table names? You and any colleagues you may have will probably appreciate having a few views over those tables that translate that gibberish to human readable stuff. You could go further and make those views updatable (by means of a few rules), but then you run the risk that colleagues start to hug you...

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.

!DSPAM:737,4bdaabce10411378620886!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ognjen Blagojevic 2010-04-30 10:11:12 Re: Java Memory Issue while Loading Postgres library
Previous Message Glyn Astill 2010-04-30 09:53:05 pg_restore: [custom archiver] dumping a specific TOC data block out of order is not supported without ID on this input stream (fseek required)