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

From Lutz Horn
Subject Re: Select "todays" timestamps in an index friendly way
Date
Msg-id 20181023101239.GB21523@lutz-pc.ecm4u.intra
Whole thread Raw
In response to Re: Select "todays" timestamps in an index friendly way  (Francisco Olarte <folarte@peoplecall.com>)
List 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 by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Select "todays" timestamps in an index friendly way
Next
From: "Lutz Horn"
Date:
Subject: Re: Select "todays" timestamps in an index friendly way