From: Gaetano Mendola <mendola@gmail.com>
To: Vladimir Kulev <me@lightoze.net>
Subject: Re: Inoptimal query plan for max() and multicolumn index
Date: Fri, 15 Jul 2011 09:14:33 +0200
Message-ID: <4E1FE8D9.7040509@gmail.com> (raw)
In-Reply-To: <BANLkTimsNMhnAHk6Wz7gARfdkTmz2QKJ7g@mail.gmail.com>
References: <BANLkTimsNMhnAHk6Wz7gARfdkTmz2QKJ7g@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: mendola@gmail.com, me@lightoze.net
Subject: Re: Inoptimal query plan for max() and multicolumn index
In-Reply-To: <4E1FE8D9.7040509@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox