Use jsonb_path_ops for containment queries
A default GIN index on a jsonb column supports every operator and is large. If all you ever do is @> containment, the jsonb_path_ops class is a third of the size and faster.
CREATE INDEX events_payload_idx ON events USING gin (payload jsonb_path_ops);
SELECT * FROM events WHERE payload @> '{"type": "refund"}';It does not support key-existence queries with ?, so pick based on the queries you actually run.
postgresqlperformance