Vladimir Kulev <me@lightoze.net> wrote:
> # explain analyze select max(timestamp) from sms where number in
> ('5502712','5802693','5801981');
> According to planner cost estimations - it has enough data to
> understand that it is better to aggregate maximum from three
> subqueries. I suppose it's not a bug but not implemented feature
Yeah, you're hoping for an optimization which hasn't been
implemented.
I expect you're hoping for a plan similar to what this gives you?:
explain analyze select greatest(
(select max(timestamp) from sms where number = '5502712'),
(select max(timestamp) from sms where number = '5802693'),
(select max(timestamp) from sms where number = '5801981'));
-Kevin