JSONB Index using GIN doesn't work on postgres

41 views Asked by At

I created index for jsonb column on postgresql, but it seems that index doesn't work when I analyzed by explain command.

Here's my command to add index.

CREATE INDEX event_data_idx on json_tbl USING gin(data jsonb_path_ops);

Here's explain code.

explain select * from json_tbl where data @> '{"type": "good"}'
+-------------------------------------------------------+
| QUERY PLAN                                            |
|-------------------------------------------------------|
| Seq Scan on event  (cost=0.00..1.11 rows=1 width=484) |
| Filter: (data @> '{"type": "good"}'::jsonb)           |
+-------------------------------------------------------+
EXPLAIN

Maybe index doesn't work. Is there wrong point on my index command? Current psql version is 9.4.1

Thanks.

0

There are 0 answers