From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | greg <gregory(dot)jevardat(at)unige(dot)ch> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: double precision[] storage space questions |
Date: | 2015-06-12 14:18:47 |
Message-ID: | 12042.1434118727@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
greg <gregory(dot)jevardat(at)unige(dot)ch> writes:
> 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
'{}' is a zero-dimensional array so it doesn't have the same
dimensionality information that your third case does. See
the comments at the head of
http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/include/utils/array.h;hb=HEAD
> The whole point is that in the application I work on, we store double arrays
> as bytea (using some serialization before storing the data).
TBH, that seems like a pretty silly decision. It guarantees that you
cannot do any useful manipulations of the array on the database side.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | mephysto | 2015-06-12 14:58:02 | PostgreSQL and iptables |
Previous Message | greg | 2015-06-12 14:08:51 | double precision[] storage space questions |