Re: - Mailing list pgsql-sql

From David G. Johnston
Subject Re:
Date
Msg-id CAKFQuwaOjOV3XS0XVpS6u1LSPcVTG6Oj_i_5hKLnm00a2ime_A@mail.gmail.com
Whole thread Raw
In response to Re:  (Steve Midgley <science@misuse.org>)
List pgsql-sql
On Tuesday, February 1, 2022, Дмитрий Воронин <carriingfate92@yandex.ru> wrote:
 
...
"dates": ["2019-10-02", "2018-02-03"]
...
 
So, I want to SELECT all docids, which dates in range:
 


So, searching on dates field will be often and I want speed up by indexing but I don't known how.

Create a generated column of type daterange and populate that on insert/update.  Index that column.  Write queries against that column. (Not tested, but in short get rid of the json pseudo daterange array implementation and use the real SQL daterange type)

David J.

pgsql-sql by date:

Previous
From: Steve Midgley
Date:
Subject: Re:
Next
From: aditya desai
Date:
Subject: Re: How can i pass variable in dblink_connect_u ?