Posts about jsonb
Articles, guides and engineering notes about jsonb from the Relyt One team.
2 articles

Postgres JSONB indexes: jsonb_ops vs jsonb_path_ops vs expression indexes, and the queries each one ignores
Which index to create for a JSONB column in PostgreSQL: the default GIN operator class, jsonb_path_ops, or a B-tree expression index. Measured on 1 million rows on Postgres 17.11: query times, index sizes and insert cost, why WHERE payload->>'key' = ... never uses a GIN index, why ? ignores jsonb_path_ops, and the partial-index statistics trap.

A Postgres audit log in one trigger: row history and "as of" queries in plain SQL
Build an audit log for any Postgres table with one generic PL/pgSQL trigger and a JSONB history table: who changed what and when, only the columns that changed, and a function that returns the table as it was at any past moment. Includes the traps (TRUNCATE, SET ROLE, connection poolers) and measured overhead on PostgreSQL 17.11.