GIN index operator ?(jsonb,text) not working? - Mailing list pgsql-general

From jian he
Subject GIN index operator ?(jsonb,text) not working?
Date
Msg-id CACJufxFcjss=F99XVA1o458XTVqfSWJcAJyTmp+E3UQcnx35bw@mail.gmail.com
Whole thread Raw
List pgsql-general
Hi,

---
create  table test101 (  doc_id bigserial, document jsonb);
insert into test101(document) values ('{"user_removed" :false}') returning *;
insert into  test101(document)  select '{"user_removed" :false}'::jsonb from generate_series(1,10000);
insert into  test101(document)  select ('{"user_remove"  :false, "test":' || i ||'}'::text)::jsonb
                                from generate_series(1,400) i;

CREATE INDEX test101_gin_user_removed_na ON test101 USING GIN (document jsonb_ops)
    where (document ? 'user_removed') is false;
CREATE INDEX test101_gin_user_removed_na_b ON test101(document)
    where (document ? 'user_removed') is false;

Since 400 is very few percent compared to 10000. 
but the following query will not use any of the indexes.
    explain (analyze)  select * from test101 where  document ? 'user_removed' is false ;



--
 I recommend David Deutsch's <<The Beginning of Infinity>>

  Jian


pgsql-general by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: help for pg_wal issue
Next
From: Karl Denninger
Date:
Subject: Re: Libpq question related to allocated resources