Speed containment queries on JSONB data.
Section: PostgreSQL index types
GIN index on JSONB
sql
sql
CREATE INDEX idx_events_payload_gin ON events USING GIN (payload jsonb_path_ops);Explanation
GIN is often used for composite or document-like structures such as JSONB and arrays.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing PostgreSQL index types