With the Postgres JSON column it just stores the JSON, so the same JSON values but with longer key names will take up more disk space. Is this also the case for JSONB columns, or does the binary abstraction sidestep this?
1
votes
1 Answers
2
votes
It looks like there is no size advantage to JSONB columns with duplicate keys across rows.
I created two tables:
CREATE TABLE temp_a (a_column json);
CREATE TABLE temp_b (b_column jsonb);
And kept inserting {"abcdefghijklmnopqrstuvwxyz": 1} into each of them. The tables both increased in size from 8192 to 16384 and then 49152 at the same rate.
SELECT pg_table_size('temp_a'); SELECT pg_table_size('temp_b');