X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id A9C3A30FA9C; Wed, 25 Jun 2003 05:57:22 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 36765-09; Wed, 25 Jun 2003 02:57:12 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by svr1.postgresql.org (Postfix) with ESMTP id EECEC30FB59; Wed, 25 Jun 2003 02:57:11 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id D6085D670; Tue, 24 Jun 2003 22:57:10 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id CBAE85C0C; Tue, 24 Jun 2003 22:57:10 -0700 (PDT) Date: Tue, 24 Jun 2003 22:57:10 -0700 (PDT) From: Stephan Szabo To: Anagha Joshi Cc: , Subject: Re: [SQL] database & table size In-Reply-To: Message-ID: <20030624223740.L18602-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200306/292 X-Sequence-Number: 9283 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).