stored short varlena in array
Quan Zongliang <quanzongliang@yeah.net>
From: Quan Zongliang <quanzongliang@yeah.net>
To: pgsql-hackers@lists.postgresql.org
Cc: quanzl@highgo.com
Date: 2024-12-25T06:29:12Z
Lists: pgsql-hackers
Hi
Now, the varlena type is stored directly in the array. Did not consider
short varlena. If it's like fill_val(), using short varlena saves memory
footprint and disk space.
In TODO, there is a requirement to be implemented:
Allow single-byte header storage for array elements
This patch modifies many files.
Based on 38da053463bef32adf563ddee5277d16d2b6c5af
Has passed the regression test.
But it can affect many contribs. The code needs to be adjusted. Like
hstore and ltree.
Disk space usage test
create table t1 (c1 varchar[]);
insert into t1
select '{a,b,c,d,e,f,g,h,i,j,k,l,m,n}'
from generate_series(1,100000);
select pg_relation_size('t1')/8192;
before
postgres=# select pg_relation_size('t1')/8192;
?column?
----------
2041
(1 row)
after
postgres=# select pg_relation_size('t1')/8192;
?column?
----------
1334
(1 row)
Memory usage
'{a,b,c,d,e,f,g,h,i,j,k,l,m,n}'::varchar[]
before
136 bytes
after
80 bytes
--
Zongliang Quan
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Try to avoid semaphore-related test failures on NetBSD/OpenBSD.
- 38da053463be 18.0 cited