Postgres jsonb vs composite type performance differences
14
votes
4
answers
6103
views
What considerations are involved in choosing between a jsonb column and a composite type column of the same structure?
For example, consider a column like that used in the Postgres documentation:
CREATE TYPE inventory_item AS (
name text,
supplier_id integer,
price numeric
);
What are the tradeoffs involved between this approach vs a jsonb column mirroring this structure?
For example, I suspect that the composite type won't require storing the key names for every record, whereas the jsonb type would require this.
Asked by Metropolis
(243 rep)
Jan 17, 2019, 04:07 PM
Last activity: Jun 17, 2024, 08:18 PM
Last activity: Jun 17, 2024, 08:18 PM