Re agregates

From: Christoph Dalitz <christoph(dot)dalitz(at)hs-niederrhein(dot)de>
To: david(at)matraex(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re agregates
Date: 2003-01-22 19:57:47
Message-ID: 20030122205747.73018b6d.christoph.dalitz@hs-niederrhein.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> is there a better way to get the max - 1?
> I could loop through and run the queriy for each customer but the cost
> on ten thousand quesries is rather high also?
>
You can directly get the "max - 1" with "order by desc" and "limit" and "offset".
It's worth a try whether that is faster (I would suspect that it is O(n*log(n))
compared to O(n^2) in your "max from max" query).

Christoph Dalitz

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Blood 2003-01-22 20:32:26 Re: agregates
Previous Message Mike Mascari 2003-01-22 19:44:19 Re: Odd subselect in target list behavior WRT aggregation