I have a table with jsonb field in table.
CREATE TABLE data.items
(
id serial NOT NULL,
datab jsonb
)
How to get size of this field in a query like this:
select id, size(datab) from data.items
For the number of bytes used to store:
select id, pg_column_size(datab) from data.items;
For the number of elements on the jsonb object:
select id, jsonb_array_length(datab) from data.items;