Re: Select "todays" timestamps in an index friendly way - Mailing list pgsql-general

From Mike Rylander
Subject Re: Select "todays" timestamps in an index friendly way
Date
Msg-id CAO8ar=mKGwR4Fdxg4NCKYOn=PhKWPuf3x+rtNBe6KAHL5+LrdA@mail.gmail.com
Whole thread Raw
In response to Select "todays" timestamps in an index friendly way  ("Lutz Horn" <lutz.horn@posteo.de>)
Responses Re: Select "todays" timestamps in an index friendly way  (David Rowley <david.rowley@2ndquadrant.com>)
List 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 by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: Select "todays" timestamps in an index friendly way
Next
From: Hellmuth Vargas
Date:
Subject: Re: Postgres 10, slave not catching up with master