Re: select within aggregate? - Mailing list pgsql-sql

From Vortex
Subject Re: select within aggregate?
Date
Msg-id 20050507181230.4044d498.vortex25@gmx.de
Whole thread Raw
In response to Re: select within aggregate?  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-sql
On Fri, 6 May 2005 07:49:23 -0500
Bruno Wolff III <bruno@wolff.to> wrote:

> You could use max(ts) as long as you can have two requests occur at the
> same time. This might be a reasonable assumption, but it might have been
> better to include a sequence so that each record would be guaranteed to
> have a unique key.
Yes, of course. So far it was more a theoretical question.

> Using DISTINCT ON to get the latest URIs is probably better. You can
> join that query to the one doing the count. This will probably be more
> efficient than executing a subquery for each remote host.
The DISTINCT ON construction looks quite interesting. It seems to allow
some sorting within an group (even althought it's no real aggregate) in
general. I can't say if it's really more eficient than the solution suggested
by R.Muralidharan. But i will do some tests!

Thank you very much!

Klaus


pgsql-sql by date:

Previous
From: "Tornroth, Phill"
Date:
Subject: Re: multi-column unique constraints with nullable columns
Next
From: Aarni Ruuhimäki
Date:
Subject: Re: encoding