PermSpace Related

Database
Enthusiast

PermSpace Related

Hi,

I want to know the actual space consumed by the data in a table.
I create a sample table:
CREATE TABLE tab_1(col_1 varchar(20));
INSERT INTO tab_1('abc');
INSERT INTO tab_1('xyz');

The size of data in the table is 6 varchar=6*2=12 bytes

But when I fire the query,
sel tablename,sum(permspace)
from dbc.tablesize
where tablename='tab_1'
and databasename=
group by 1

I get the sum(PermSpace) as some huge value like 77265.

Pls suggest how can I get the actual size of data in the table.
Also why the Permspace value is so high?
Does the td dbc preallocate space for the the table?

Tags (1)
1 REPLY
Enthusiast

Re: PermSpace Related

How many AMPs are there in your system? An empty table will use a minimum of 512 bytes on each AMP, so 77KB would be the approximate expected space usage for a smallish (150 AMP) system. The actual number you reported, 77265, is anomalous, as disk space is always allocated in increments of 512 bytes. Since each of the 2 rows you inserted will likely land on different AMPs, expect the resulting space usage to be 1024 bytes greater than for the empty table.