Re: Indexing on JSONB field not working

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Zhihong Zhang <zhihong(at)gmail(dot)com>
Cc: pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Indexing on JSONB field not working
Date: 2019-12-20 22:57:37
Message-ID: CAMkU=1zPbphLfucRN7j7bAwb=9YAGB0cucc_t_MaqKk+rwYTQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Dec 20, 2019 at 5:12 PM Zhihong Zhang <zhihong(at)gmail(dot)com> wrote:

> I have an index on JSONB fields like this,
>
>
>
> CREATE INDEX float_number_index_path2
>
> ON public.assets USING btree
>
> (((_doc #> '{floatValue}'::text[])::double precision) ASC NULLS LAST)
>
> TABLESPACE pg_default;
>
>
>
> However query doesn’t use it,
>

Did you analyze the table after building the index? Expression indexes
have their own statistics, but they don't get populated until the table is
analyzed.

Cheers,

Jeff

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeremy Schneider 2019-12-20 23:21:30 Re: logical decoding bug: segfault in ReorderBufferToastReplace()
Previous Message Tomas Vondra 2019-12-20 22:30:05 Re: Indexing on JSONB field not working