Indexing on JSONB field not working

Поиск
Список
Период
Сортировка
От Zhihong Zhang
Тема Indexing on JSONB field not working
Дата
Msg-id 0cf001d5b77f$bfe47e10$3fad7a30$@gmail.com
обсуждение исходный текст
Ответы Re: Indexing on JSONB field not working  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Re: Indexing on JSONB field not working  (Jeff Janes <jeff.janes@gmail.com>)
Список pgsql-bugs

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,

 

explain select id, _doc->>'floatValue' from assets where (_doc #> '{floatValue}'::text[])::double precision < 3.0 limit 3;

 

Limit  (cost=0.00..3.24 rows=3 width=53)

  ->  Seq Scan on assets  (cost=0.00..936605.40 rows=867607 width=53)

        Filter: (((_doc #> '{floatValue}'::text[]))::double precision < '3'::double precision)

 

The version of the database,

 

"PostgreSQL 11.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16), 64-bit"

 

However, the index works for text field in JSONB.

 

Let me know if I can provide more information.

 

Zhihong Zhang

zhihong@gmail.com

 

 

 

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tomas Zubiri
Дата:
Сообщение: Re: psql: Buggy interactions with wraparound in maximized gnome terminals.
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: Indexing on JSONB field not working