GIN Index
GIN index stands for Generalised Invert Index.
Speeds up full text searches
A GIN index stores a set of (key, posting list) pairs, where a posting list is a set of row IDs in which the key occurs. The same row ID can appear in multiple posting lists, since an item can contain more than one key.
Each key value is stored only once, so a GIN index is very compact for cases where the same key appears many times.
Query
select * from contacts_docs
where body @> '{"first_name":"John"}';
explain select * from contacts_docs
where body @> '{"first_name":"John"}';
Creating a GIN Index

Get Size of Index

Using JSONB_PATH_OPS ( better )

Size with jsonb_path_ops

On Specific column for smaller size ( not working )

Last updated
Was this helpful?