Re: jsonb on-disk size calculation

2023-07-31 Thread Junwang Zhao
convertJsonbObject convert JsonValue to Jsonb. Jsonb->vl_len_ is 4 byte JsonbContainer->header is 4 bytes JsonbContainer->children is an array of two elements, that's 8 bytes following the k/v part, 20 bytes In total 36 bytes. When Jsonb is stored to disk, I guess some conversion reduces the vl_

Re: jsonb on-disk size calculation

2023-07-31 Thread Adrian Klaver
On 7/31/23 04:10, jian he wrote: hi. drop table x; create table x(js jsonb); insert into x select '{"Hello world":1}'::jsonb; select pg_column_size(js) from x;-- return 33. based on src/include/utils/jsonb.h The key and value part is 20 bytes (is it correct?), Jsonb->vl_len_  is 4 byte, Jsonb