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

From Thomas Kellerer
Subject Re: Select "todays" timestamps in an index friendly way
Date
Msg-id 85054faa-c527-f9e8-d3a8-b68d4d26421f@gmx.net
Whole thread Raw
In response to Re: Select "todays" timestamps in an index friendly way  ("Lutz Horn" <lutz.horn@posteo.de>)
Responses Re: Select "todays" timestamps in an index friendly way  (Hellmuth Vargas <hivs77@gmail.com>)
List pgsql-general
Lutz Horn schrieb am 23.10.2018 um 12:19:
> Hi Thomas,
> 
> On Tue, Oct 23, 2018 at 12:11:55PM +0200, Thomas Kellerer wrote:
>> I typically use:
>>
>>   where ts >= date '2018-10-23'
>>     and ts < date '2018-10-23' + 1
> 
> But here the date is an explicit value. Francisco reworded my question:
> 
>> if your definition of today is 'same value as now() when truncated to
>> days'
> 
> That's what I am (was, thanks to Francisco) looking for.

Then use current_date:

   where ts >= current_date
     and ts < current_date + 1



pgsql-general by date:

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