Multiple aggs,sums in 1 query - Mailing list pgsql-general

From Dorian Hoxha
Subject Multiple aggs,sums in 1 query
Date
Msg-id CANsFX04074WyMDC=559fr8Ef_O9h1Dn=LL+HLX3hAHu5o8fApQ@mail.gmail.com
Whole thread Raw
Responses Re: Multiple aggs,sums in 1 que
List pgsql-general
I have: create table tbl (a,b,c,d,e,f,g,h);

And i need to select in 1 query ,or the most performant way:

top 5(a)
top 5(b)
top 5(c): for each top5(c): top 5(d)
count(f) GROUP BY f


I can make these in separate queries but that means that postgresql would read the table multiple-times?

Is it possible/doable/sane ?

Thanks

pgsql-general by date:

Previous
From: Mike Kienenberger
Date:
Subject: Browsing postgres database using the Eclipse QuantumDB plugin
Next
From: Albe Laurenz
Date:
Subject: Re: PG replication across DataCenters