| From: | Vortex <vortex25(at)gmx(dot)de> |
|---|---|
| To: | Bruno Wolff III <bruno(at)wolff(dot)to> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: select within aggregate? |
| Date: | 2005-05-07 16:12:30 |
| Message-ID: | 20050507181230.4044d498.vortex25@gmx.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
On Fri, 6 May 2005 07:49:23 -0500
Bruno Wolff III <bruno(at)wolff(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Aarni Ruuhimäki | 2005-05-07 16:32:35 | Re: encoding |
| Previous Message | Derek Buttineau|Compu-SOLVE | 2005-05-06 20:54:57 | Re: [SQL] ORDER BY Optimization |