Correct table size when a using short integer array type.

From: "Shivin M" <shivinm(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Correct table size when a using short integer array type.
Date: 2007-06-18 05:52:40
Message-ID: 1773e4d70706172252k48fefbe5y4281fbb2e0356d6f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello!

I'm trying to store an array of short integers in a table. The array that I
have is very long, consisting of ~6000000 elements (each element is a value
from a time-series, hence the length). Given that all the values in the time
series are of short integer type, I'd expect them to use:

6000000 x 2 Bytes = 12 MB

So somewhere around 12 MB.

Here are the statistics of the table in which I inserted these values (the
table has attributes: id - int4; digital_values - int2[] )

Table statisticsStatistic Value
Sequential Scans 2
Sequential Tuples Read 1
Index Scans 1
Index Tuples Fetched 1
Tuples Inserted 1
Tuples Updated 1
Tuples Deleted 0
Heap Blocks Read 0
Heap Blocks Hit 0
Index Blocks Read 0
Index Blocks Hit 0
Toast Blocks Read 0
Toast Blocks Hit 0
Toast Index Blocks Read 0
Toast Index Blocks Hit 0
Table Size 8192 bytes
*Toast Table Size 19 MB*
Indexes Size 16 kB

-----

The toast table size is 19 MB. Is there a reason why I see more physical
storage used by the table than what I'd expect it to use? I have to do this
for many more records and tables. Thus it makes a huge impact, storage-wise.

Thanks!

- Shivin

Browse pgsql-novice by date

  From Date Subject
Next Message Tommy Gildseth 2007-06-18 06:08:22 Re: Stuck (again) trying to move a 7.x app and database to 8.2
Previous Message Andrej Ricnik-Bay 2007-06-17 01:25:02 Re: Connecting to the database via TCP/IP