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

Поиск
Список
Период
Сортировка
От Mike Rylander
Тема Re: Select "todays" timestamps in an index friendly way
Дата
Msg-id CAO8ar=mKGwR4Fdxg4NCKYOn=PhKWPuf3x+rtNBe6KAHL5+LrdA@mail.gmail.com
обсуждение исходный текст
Ответ на Select "todays" timestamps in an index friendly way  ("Lutz Horn" <lutz.horn@posteo.de>)
Ответы Re: Select "todays" timestamps in an index friendly way  (David Rowley <david.rowley@2ndquadrant.com>)
Список pgsql-general
On Tue, Oct 23, 2018 at 5:38 AM Lutz Horn <lutz.horn@posteo.de> wrote:
>
> Hi,
>
> I am looking for a way to select all timestamps that are "today" in an
> index friendly way. This select should not depend on the concrete value
> of "today".
>

Per TFM, https://www.postgresql.org/docs/10/static/datatype-datetime.html
on table 8.13, you can use special input values:

SELECT * FROM t WHERE ts >= 'today'::timestamp AND ts < 'tomorrow'::timestamp;

HTH,

--
Mike Rylander
 | Executive Director
 | Equinox Open Library Initiative
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker@equinoxinitiative.org
 | web:  http://equinoxinitiative.org


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

Предыдущее
От: Francisco Olarte
Дата:
Сообщение: Re: Select "todays" timestamps in an index friendly way
Следующее
От: Hellmuth Vargas
Дата:
Сообщение: Re: Postgres 10, slave not catching up with master