Re: Inoptimal query plan for max() and multicolumn index - Mailing list pgsql-performance

From Gaetano Mendola
Subject Re: Inoptimal query plan for max() and multicolumn index
Date
Msg-id 4E1FE8E5.5000408@gmail.com
Whole thread Raw
In response to Inoptimal query plan for max() and multicolumn index  (Vladimir Kulev <me@lightoze.net>)
List pgsql-performance
On 20/06/2011 07:35, Vladimir Kulev wrote:

> But this does not work:
> # explain analyze select max(timestamp) from sms where number in
> ('5502712','5802693','5801981');

Try to rewrite that query this way:

explain analyze select timestamp from sms where number in
('5502712','5802693','5801981') order by timestamp desc limit 1;


Regards
Gaetano Mendola



pgsql-performance by date:

Previous
From: Greg Smith
Date:
Subject: Re: Hardware advice for scalable warehouse db
Next
From: jesper@krogh.cc
Date:
Subject: Re: Hardware advice for scalable warehouse db