Correct table size when a using short integer array type. - Mailing list pgsql-novice

From Shivin M
Subject Correct table size when a using short integer array type.
Date
Msg-id 1773e4d70706172252k48fefbe5y4281fbb2e0356d6f@mail.gmail.com
Whole thread Raw
List 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


 


pgsql-novice by date:

Previous
From: "Andrej Ricnik-Bay"
Date:
Subject: Re: Connecting to the database via TCP/IP
Next
From: Tommy Gildseth
Date:
Subject: Re: Stuck (again) trying to move a 7.x app and database to 8.2