Re: Select on timestamp-day slower than timestamp alone
В списке pgsql-performance по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Select on timestamp-day slower than timestamp alone |
| Дата | |
| Msg-id | 24863.1052229548@sss.pgh.pa.us обсуждение |
| Ответ на | Re: Select on timestamp-day slower than timestamp alone (Richard Huxton <dev@archonet.com>) |
| Список | pgsql-performance |
Richard Huxton <dev@archonet.com> writes:
> Well, the "why" is because the number of rows recommended is so big
> (rows=10253528) - I'm also puzzled why we get "timestamp without time zone".
Because that's what he specified the constant to be.
> Does an explicit cast to "with time zone" help?
Writing the constant as timestamp with time zone would fix it.
Casting after-the-fact would not.
The reason: although both "timestamp minus interval" and "timestamptz
minus interval" are constant-foldable, timestamp-to-timestamptz
conversion is not (because it depends on SET TIMEZONE). So the
planner has to fall back to a default selectivity estimate. With real
constants it is able to derive a better estimate.
regards, tom lane
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера