Re:

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Steve Midgley <science(at)misuse(dot)org>
Cc: Дмитрий Воронин <carriingfate92(at)yandex(dot)ru>, pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Re:
Date: 2022-02-01 20:10:53
Message-ID: CAHOFxGoYkZaiGpe=xpLDeiS3xwN=vfstjp3iPJoMBOkkaHRd8A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Feb 1, 2022, 9:16 AM Steve Midgley <science(at)misuse(dot)org> wrote:

>
>
> On Tue, Feb 1, 2022 at 12:42 AM Дмитрий Воронин <carriingfate92(at)yandex(dot)ru>
> wrote:
>
>>
>> SELECT attrs FROM document_resinfo WHERE attrs @? '$.dates[*].datetime()
>> ? (@ >= "2020-10-02".datetime())';
>>
>> How can I create index on attrs field to query docids with other date?
>> Thanks.
>>
>>
>
> Have you tried just putting a default index on that column? I think it
> should work fine.
>
> CREATE INDEX attrs_idx ON test (attrs)
>

You'd want to use gin index type. Btree won't be very helpful.

I would consider a btree on the jsonb key itself.

One major hesitation I have with using jsonb much is that you don't get
statistics on the distribution of data (ndistinct, mcv, histogram, etc).

>

In response to

  • Re: at 2022-02-01 16:15:40 from Steve Midgley

Browse pgsql-sql by date

  From Date Subject
Next Message Дмитрий Воронин 2022-02-02 05:38:18 Re:
Previous Message Steve Midgley 2022-02-01 16:15:40 Re: