SV: where clauses including timstamptz and intervals

Поиск
Список
Период
Сортировка
От Niels Jespersen
Тема SV: where clauses including timstamptz and intervals
Дата
Msg-id 7fa490f5d64749bd92ba1f78c0c6b80e@dst.dk
обсуждение исходный текст
Ответ на Re: where clauses including timstamptz and intervals  (Francisco Olarte <folarte@peoplecall.com>)
Список pgsql-general
>-----Oprindelig meddelelse-----
>Fra: Francisco Olarte <folarte@peoplecall.com> 
>Sendt: 10. april 2021 09:31
>Til: Niels Jespersen <NJN@dst.dk>
>
>Although it is equivalent I would suggest to use:
>
>f.r_time< ('2020-10-01 00:00:00+00'::timestamptz at time zone 'utc' + interval '1 month') at time zone 'utc' ;
>
>optimizer should treat both the same, but I'm no sure it can recognize it, and it may not see your condition is of the
type"field < constant" to select index scans and similar things. Also, you can refactor your calculations into an
stablefunction for greater clarity.
 

The plannes seems to be able to figure this out nicely. 
>
>> I think maybe it's better to just change the session timezone when this need arises.
>
>Maybe. Also, I do not see the need to query exact partitions by tstz range, but assuming you do it may be much easier
toquery the catalog for the partition and then query the partition. ( In many years of working with time-partitioned
tablesI have never got the need to build a query to hit exactly X partitions from times ).
 
>
I need to hit an exact partition, because the query makes some QA on data coming from a file that fits that exact
timeslot.File and partition must match exactly because the file may be raplaced later and the partition truncated. 
 

Thank you for your insights.

Niels

>Francisco Olarte.

В списке pgsql-general по дате отправления:

Предыдущее
От: Rama Krishnan
Дата:
Сообщение: Re: Query processing in postgresql
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: Query processing in postgresql