Hello ,
Here is something I’ve found related to database & table size
My databse name is ’test’ and table name is ‘cdrrec’.
test=# select datname, oid from pg_database;
datname | oid
-------------+---------
fcsconfigdb | 16562
template1 | 1
template0 | 16555
fcsauditdb | 16565
fcsbsdb | 16566
fcsmibdb | 32386
fcstrapdb | 52561
test | 1580177
(8 rows)
test=# select oid from pg_class where relname = 'cdrrec';
oid
---------
2078989
(1 row)
$ cd /export/home/uxapps/postgresql-7.2.4/data/base/
$ ls -l
total 32
drwx------ 2 postgres postgres 1536 Jun 6 17:13 1
drwx------ 2 postgres postgres 1536 Jun 24 15:02 1580177
drwx------ 2 postgres postgres 1536 Jun 6 17:02 16555
drwx------ 2 postgres postgres 2048 Jun 6 18:04 16562
drwx------ 2 postgres postgres 1536 Jun 10 16:18 16565
drwx------ 2 postgres postgres 2048 Jun 6 18:03 16566
drwx------ 2 postgres postgres 1536 Jun 6 17:41 32386
drwx------ 3 postgres postgres 1536 Jun 19 11:08 52561
$ cd 1580177
$ ls -l 2078989
-rw------- 1 postgres postgres 2359296 Jun 24 17:18 2078989
This means table ’cdrrec’ takes approx. 2030.2626953125 KB i.e. approx. 2MB
Table is like this:
test=# \d cdrrec;
Table "cdrrec"
Column | Type | Modifiers
---------+-----------------------+------------------------------------------------------
seqno | integer | not null default nextval('"cdrrec_seqno_seq"'::text) //4 bytes
timerec | bigint | //8 bytes
ack | boolean | default 'f'::bool //1 byte
pos | boolean | default 'f'::bool //1 byte
ipaddr | character varying(16) | // 4 + 16
cdrs | bit varying(524288) | //64K
Primary key: cdrrec_pkey
*Sizes are as per documentation.
Therefore, 1 record is of 65570 bytes i.e. 64.033203125 KB.
And table contains 1000 records.
But results are noway closer to ‘2MB”.
Any idea?
Thanks,
Anagha