json vs jsonb in PostgreSQL: size and speed, measured

json vs jsonb in PostgreSQL 17 and 18, measured on six document shapes: when jsonb is 23% smaller or 41% larger, read speed, GIN, and what it changes.

Chris van Eijk, Now-Next · 9 November 2026 · 10 min read

Now-Next builds SaaS products and takes over existing ones. What we build →

Whether jsonb takes more room than json depends on the JSON you put in, not on the type alone. In PostgreSQL 17.11 and 18.6, which stored every table byte for byte the same size, a million compact documents of about 200 bytes took 17.8% more room as jsonb, while the same documents pretty-printed took 3.6% less; across six document shapes, two input forms and two compression methods we measured everything from 22.6% smaller to 40.9% larger. Reading one key with ->> was 2.7 to 10.6 times faster from jsonb in every case we timed, and only jsonb can be compared, grouped or indexed for containment at all.