Postgres Array Overhead – What is the Impact?

arraypostgresql

What is the additional overhead of an array compared to a normal column of that same datatype? In other words, if an array will almost always have one value in it, how much space would I be "wasting" by using an array instead of a normal column?

Best Answer

You can check that using pg_column_size():

select pg_column_size(1::integer) as int_size, 
       pg_column_size(array[1]::integer[]) as array_size

returns:

int_size | array_size
---------+-----------
       4 |         28

So the overhead is substantial for just a single value.