Why are tables sizes so big?

Started by God_Of_Painabout 25 years ago4 messagesgeneral
Jump to latest
#1God_Of_Pain
silicontao_roy@technologist.com

I have a Win32 app connecting to a PostgreSQL server via Delphi -> BDE ->
ODBC -> PostgreSQL. The app takes CSV files and stores them on the
PostgreSQL server. An empty CSV file makes a table that is 8kB in size on
the server and that is fine but for every 1kB of text in the CSV file the
PostgreSQL file gains about 5kB.

The CSV file has 5 text fields that I change to char size 10, float, float,
int and float. That in it's self sould make the data on the server much
smaller, but it is not, it is bigger, why?

#2Richard Huxton
dev@archonet.com
In reply to: God_Of_Pain (#1)
Re: Why are tables sizes so big?

God_Of_Pain wrote:

I have a Win32 app connecting to a PostgreSQL server via Delphi -> BDE ->
ODBC -> PostgreSQL. The app takes CSV files and stores them on the
PostgreSQL server. An empty CSV file makes a table that is 8kB in size on
the server and that is fine but for every 1kB of text in the CSV file the
PostgreSQL file gains about 5kB.

The CSV file has 5 text fields that I change to char size 10, float, float,
int and float. That in it's self sould make the data on the server much
smaller, but it is not, it is bigger, why?

char = 10 + 4
floats= 8 * 3
int = 4
oid = 4

That's at least 46 bytes per row plus indexes - which can take up a lot.
Does that look plausible?

- Richard Huxton

#3Trewern, Ben
Ben.Trewern@mowlem.com
In reply to: Richard Huxton (#2)
RE: Why are tables sizes so big?

As an aside you, and anyone else who uses Delphi / C++ builder, may want to
try the components at the following link:

http://www.zeos.dn.ua/develop/zeosdbo-5.2.3-beta.zip

With Homepage:

http://www.zeos.dn.ua

they are replacements for the standard data access components and directly
connect to PostgreSQL (and other dbs). They are still in beta but seem to
work better (and much faster) than ODBC / BDE

Regards

Ben

Show quoted text

-----Original Message-----
From: God_Of_Pain [mailto:silicontao_roy@technologist.com]
Sent: 05 March 2001 16:35
To: pgsql-general@postgresql.org
Subject: [GENERAL] Why are tables sizes so big?

I have a Win32 app connecting to a PostgreSQL server via
Delphi -> BDE ->
ODBC -> PostgreSQL. The app takes CSV files and stores them on the
PostgreSQL server. An empty CSV file makes a table that is
8kB in size on
the server and that is fine but for every 1kB of text in the
CSV file the
PostgreSQL file gains about 5kB.

The CSV file has 5 text fields that I change to char size 10,
float, float,
int and float. That in it's self sould make the data on the
server much
smaller, but it is not, it is bigger, why?

---------------------------(end of
broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Richard Huxton (#2)
Re: Why are tables sizes so big?

Richard Huxton <dev@archonet.com> writes:

The CSV file has 5 text fields that I change to char size 10, float, float,
int and float. That in it's self sould make the data on the server much
smaller, but it is not, it is bigger, why?

char = 10 + 4
floats= 8 * 3
int = 4
oid = 4

That's at least 46 bytes per row plus indexes - which can take up a lot.

Actually, the per-row overhead is not just an OID: there are several
other system fields too. On a typical machine it's going to be 32 bytes
not four. Possibly more if you have nulls in the row; see
src/include/access/htup.h if you're interested.

regards, tom lane