January 2019
Beginner
556 pages
14h 19m
English
JSONB documents can be indexed using the GIN index, and the index can be used for the following operators:
To see the effect of indexing on the json_doc table, let's create an index and disable the sequential scan, as follows:
CREATE INDEX ON json_doc(doc);SET enable_seqscan = off;
We can use the following code to test the index function:
car_portal=# EXPLAIN SELECT * FROM json_doc WHERE doc @> '{"name":"John"}'; QUERY PLAN ---------------------------------------------------------------------------------------- ...Read now
Unlock full access