B-tree index on a jsonb, array, or tsvector column
Note — this works and blocks nothing, but a performance regression is likely.
What it catches
A B-tree on a jsonb, array, or tsvector column only serves equality and ordering on the whole value — never the containment (@>), key-existence (?), or text-search (@@) operators those types exist for. The queries that motivated the index still sequential-scan, and the index (often huge, since it stores whole documents) taxes every write.
Fires on
CREATE INDEX idx_events_payload ON events (payload);Do this instead
Use GIN: it indexes the elements inside the value, so containment, key-existence, and full-text operators can use it. For jsonb, jsonb_path_ops is smaller and faster when you only need @>. An expression index on a specific key (payload->>'kind') is the right choice when queries target one field. An opclass or a UNIQUE index keeps this rule silent — those are deliberate.
CREATE INDEX CONCURRENTLY idx_events_payload ON events USING gin (payload jsonb_path_ops); This rule runs in the hosted service on Startup and above — add --remote with a team token, or use the GitHub Action: npx bolvrk check migration.sql