Re: histogram

From: Thomas Markus <t(dot)markus(at)proventis(dot)net>
To: Joel Reymont <joelr1(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: histogram
Date: 2011-04-30 16:48:59
Message-ID: 4DBC3D7B.804@proventis.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

try something like this:

select
trunc(random() * 10.)/10.
, count(*)
from
generate_series(1,2000000)
group by 1 order by 2

regards
Thomas

Am 30.04.2011 18:37, schrieb Joel Reymont:
> I have a column of 2 million float values from 0 to 1.
>
> I would like to figure out how many values fit into buckets spaced by 0.10, e.g. from 0 to 0.10, from 0.10 to 0.20, etc.
>
> What is the best way to do this?
>
> Thanks, Joel
>
> --------------------------------------------------------------------------
> - for hire: mac osx device driver ninja, kernel extensions and usb drivers
> ---------------------+------------+---------------------------------------
> http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
> ---------------------+------------+---------------------------------------
>
>
>
>

In response to

  • histogram at 2011-04-30 16:37:17 from Joel Reymont

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joel Reymont 2011-04-30 16:53:11 Re: histogram
Previous Message Joel Reymont 2011-04-30 16:37:17 histogram