Re: Normalized storage to denormalized report

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Normalized storage to denormalized report
Date: 2006-01-19 12:45:28
Message-ID: BFF4F418.3FF5%sdavis2@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1/19/06 7:14 AM, "Martijn van Oosterhout" <kleptog(at)svana(dot)org> wrote:

> On Thu, Jan 19, 2006 at 07:03:47AM -0500, Sean Davis wrote:
>> I have a table that stores data like so:
>
> <snip>
>
>> And I would like to design a query that gives:
>>
>> Clone_idx expt_id_1 expt_id_2 ....
>> 1 0.7834 0.8231 ....
>> 2 0.2832 1.2783 ....
>>
>> There are several tens-of-thousands of clone_idx entries, so doing this
>> quickly may not even be possible. Any suggestions on how to go from this
>> normalized structure to the denormalized form easily. Note that this isn't
>> exactly a crosstab, since there is no counting data, just reshaping.
>
> Although you may not call it exactly a crosstab, the crosstab
> functions in contrib/tablefunc should solve your problem nicely.
>
> Have a nice day,

Thanks Martijn and Michael. Crosstab functions will do the trick (though
for production, I think I will have to use some materialized views....)

Sean

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2006-01-19 12:51:55 Re: mount -o async - is it safe?
Previous Message A. Kretschmer 2006-01-19 12:40:10 Re: Insert a default timestamp when nothing given