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  (Vladimir Kulev <me@lightoze.net>)
Список 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 по дате отправления:

Предыдущее
От: Claudio Freire
Дата:
Сообщение: Re: how to know slowly query in lock postgre
Следующее
От: Sushant Sinha
Дата:
Сообщение: sequential scan unduly favored over text search gin index