Re: Inoptimal query plan for max() and multicolumn index
| От | Kevin Grittner |
|---|---|
| Тема | Re: Inoptimal query plan for max() and multicolumn index |
| Дата | |
| Msg-id | 4DFF23CC020000250003E994@gw.wicourts.gov обсуждение исходный текст |
| Ответ на | Inoptimal query plan for max() and multicolumn index (Vladimir Kulev <me@lightoze.net>) |
| Ответы |
Re: Inoptimal query plan for max() and multicolumn index
|
| Список | pgsql-performance |
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
В списке pgsql-performance по дате отправления: