Re: Histogram generator

From: Dann Corbit <DCorbit(at)connx(dot)com>
To: 'Patrick May' <patrick(dot)may(at)mac(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Histogram generator
Date: 2010-07-27 23:12:13
Message-ID: 87F42982BF2B434F831FCEF4C45FC33E254080D5@EXCHANGE.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-
> owner(at)postgresql(dot)org] On Behalf Of Patrick May
> Sent: Tuesday, July 27, 2010 3:59 PM
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] Histogram generator
>
> Hi,
>
> I have a table containing events with timestamps. I would like
> to generate a histogram of the number of each type of event for each
> half-hour period from 8:00 am to 6:00 pm. Are there any tools that
> will help me do this?

GROUP BY is essentially a histogram generator.
The age() function will give you an interval.

I am not sure if you want to combine half hour periods from different days with the same time or not (IOW are 8AM Tuesday and 8AM Wednesday supposed to be grouped together or not?)

I guess that if you are more specific about exactly what you want you can get a better answer. Your requirement is a little bit vague or ambiguous.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-07-28 00:27:48 Re: Incorrect FTS result with GIN index
Previous Message John R Pierce 2010-07-27 22:59:26 Re: Must be owner of function