Re: general design question - Mailing list pgsql-general

From Tom Lane
Subject Re: general design question
Date
Msg-id 18031.1019273855@sss.pgh.pa.us
Whole thread Raw
In response to Re: general design question  (Curt Sampson <cjs@cynic.net>)
Responses Re: general design question  (Curt Sampson <cjs@cynic.net>)
List pgsql-general
Curt Sampson <cjs@cynic.net> writes:
> However, for tables that are already narrow, you may get little
> performance gain, or in some cases performance may even get worse,
> not to mention your data size blowing up bigger. Postgres has a
> quite high per-tuple overhead (31 bytes or more) so splitting small
> tables can actually cause growth and make things slower, if you
> frequently access both tables.

Right.  The *minimum* row overhead in Postgres is 36 bytes (32-byte
tuple header plus 4-byte line pointer).  More, the actual data space
will be rounded up to the next MAXALIGN boundary, either 4 or 8 bytes
depending on your platform.  On an 8-byte-MAXALIGN platform like mine,
a table containing a single int4 column will actually occupy 44 bytes
per row.  Ouch.  So database designs involving lots of narrow tables
are not to be preferred over designs with a few wide tables.

AFAIK, all databases have nontrivial per-row overheads; PG might be
a bit worse than average, but this is a significant issue no matter
which DB you use.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Backup very large databases
Next
From: Curt Sampson
Date:
Subject: Re: general design question