Re: SELECT LIMIT 1 VIEW Performance Issue - Mailing list pgsql-performance

From Simon Riggs
Subject Re: SELECT LIMIT 1 VIEW Performance Issue
Date
Msg-id 1127474141.19345.10.camel@localhost.localdomain
Whole thread Raw
In response to Re: SELECT LIMIT 1 VIEW Performance Issue  (K C Lau <kclau60@netvigator.com>)
Responses Re: SELECT LIMIT 1 VIEW Performance Issue  (K C Lau <kclau60@netvigator.com>)
List pgsql-performance
On Thu, 2005-09-22 at 18:40 +0800, K C Lau wrote:
> > > esdt=> explain analyze select PlayerID,AtDate from Player a
> > >   where PlayerID='22220' and AtDate = (select b.AtDate from Player b
> > >   where b.PlayerID = a.PlayerID order by b.PlayerID desc, b.AtDate desc
> > > LIMIT 1);

I think you should try:

select distinct on (PlayerID) PlayerID,AtDate from Player a
where PlayerID='22220' order by PlayerId, AtDate Desc;

Does that work for you?

Best Regards, Simon Riggs


pgsql-performance by date:

Previous
From: Michael Stone
Date:
Subject: Re: How to determine cause of performance problem?
Next
From: Arjen van der Meijden
Date:
Subject: Re: How to determine cause of performance problem?