Re: Inoptimal query plan for max() and multicolumn index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



--
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux