Re: [SQL] database & table size

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Anagha Joshi <ajoshi(at)nulinkinc(dot)com>
Cc: <pgsql-admin(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [SQL] database & table size
Date: 2003-06-25 05:57:10
Message-ID: 20030624223740.L18602-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql


On Wed, 25 Jun 2003, Anagha Joshi wrote:

> 4. the file '2078989' corresponds to 'cdrrec' file (table)
>
> $ 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?

The two varyings won't necessarily take up the full size if the actual
data is smaller IIRC and large values of cdrs will be compressed and/or
stuck into a toast table. You should look for the associated toast table
and factor its space in as well (I think reltoastrelid in the pg_class
row for cdrrec will give you the appropriate oid to look for).

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Frankie Lam 2003-06-25 06:19:09 Re: database & table size
Previous Message Anagha Joshi 2003-06-25 04:34:29 database & table size

Browse pgsql-sql by date

  From Date Subject
Next Message Frankie Lam 2003-06-25 06:19:09 Re: database & table size
Previous Message Anagha Joshi 2003-06-25 04:34:29 database & table size