From: | greg <gregory(dot)jevardat(at)unige(dot)ch> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | double precision[] storage space questions |
Date: | 2015-06-12 14:08:51 |
Message-ID: | 1434118131655-5853581.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all
I cannot find any documentation on the space taken by a double precision
array. And the few tests I did surprise me.
Here are a few tries I did to understand
select pg_column_size(1.1::double precision) return 8 --- as
expected
select pg_column_size('{}'::double precision[]) return 16 --- ok
maybe an array header
select pg_column_size('{1.111}'::double precision[]) return 32 --- I
expected 16+ sizeof(double) = 24
select pg_column_size('{1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0}'::double
precision[]) return 104 --- I'am lost because I expected 10*16 + 16 = 176.
It is neither 16+10*8 (96)
So what is happening behind the scene, I did not found any documentation.
Since the queries are done in memory I suppose no compression is going on.
Furthermore select
pg_column_size('{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}'::double
precision[]) return 104 as well. So I discard compression.
The whole point is that in the application I work on, we store double arrays
as bytea (using some serialization before storing the data).
I was very surprised to see that the storage of an array of double take more
space using double precision[] than serializing it and storing it into a
bytea.
Thanks for any help and docs
--
View this message in context: http://postgresql.nabble.com/double-precision-storage-space-questions-tp5853581.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-06-12 14:18:47 | Re: double precision[] storage space questions |
Previous Message | Tom Lane | 2015-06-12 13:48:21 | Re: support for ltree |