Re: Select "todays" timestamps in an index friendly way

Поиск
Список
Период
Сортировка
От Lutz Horn
Тема Re: Select "todays" timestamps in an index friendly way
Дата
Msg-id 20181023101239.GB21523@lutz-pc.ecm4u.intra
обсуждение исходный текст
Ответ на Re: Select "todays" timestamps in an index friendly way  (Francisco Olarte <folarte@peoplecall.com>)
Список pgsql-general
Hi Francisco,

On Tue, Oct 23, 2018 at 12:05:17PM +0200, Francisco Olarte wrote:
> 1st remark. Do NOT use closed interval for timestamps. Always use
> half-open or you'll run into problems

Good point, thanks.

> where ts >=  date_trunc('day',now())
>     and ts < date_trunc('day',now()+'1 day') as tomorrow;
> 
> IIRC this should use the index

And it does! Thanks!

Lutz


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

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: Select "todays" timestamps in an index friendly way
Следующее
От: "Lutz Horn"
Дата:
Сообщение: Re: Select "todays" timestamps in an index friendly way