1

I have a jsonb row with objects/dictionairies : {"a":1, "b":2, "c",3}

I want to query rows that contain a set of keys, ex:

SELECT * from my_table v 
WHERE v.my_jsonb_column::jsonb ?| array['b','a']

how can I create an index for this query ?

1

This index does it :

CREATE INDEX my_idx on my_table USING GIN (my_jsonb_column);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.