Re: [HACKERS] database size

Micha3 Mosiewicz <mimo@lodz.pdi.net>

From: "Micha Mosiewicz" <mimo@lodz.pdi.net>
To: Shiby Thomas <sthomas@cise.ufl.edu>
Cc: pgsql-hackers@postgreSQL.org
Date: 1998-01-06T23:37:43Z
Lists: pgsql-hackers
Shiby Thomas wrote:
> 
> Hi,
> 
> I created a table with two columns of type int, and loaded about 300 K records
> in it. So, the total size of the table is approx. that of 600 K integers,
> roughly 2.4 MB.
> But, the file corresponding to the table in pgsql/data/base directory
> has a size of 19 MB. I was wondering if I have done something wrong in
> the installation or usage, or is it the normal behavior ?

This is OK. First thing - int is not 2 bytes long, it's 4 bytes long.
Use int2 if you want so. Second - you have to add up other per-record
stuff like oids and other internal attributes. 

> Also, I was trying to execute the query:
> select item as item, count(*) as cnt into table C_temp
> from temp group by item;
> 
> Here, temp is the name of the table which contains the data and item is an
> integer attribute. While doing the sort for the group by, the size of one of
> the temporary pg_psort relation grows to about 314 MB. The size of the temp
> table is as mentioned above. 

It ain't good. Seems like the psort is very hungry. 

Mike

-- 
WWW: http://www.lodz.pdi.net/~mimo  tel: Int. Acc. Code + 48 42 148340
add: Michal Mosiewicz  *  Bugaj 66 m.54 *  95-200 Pabianice  *  POLAND