Re: Single Byte values - Mailing list pgsql-general

From Manfred Koizar
Subject Re: Single Byte values
Date
Msg-id lp8r8vot69rspsmfo1mj217e0071u8pjv1@4ax.com
Whole thread Raw
In response to Re: Single Byte values  (Jason Hihn <jhihn@paytimepayroll.com>)
List pgsql-general
On Fri, 04 Apr 2003 09:13:54 -0500, Jason Hihn
<jhihn@paytimepayroll.com> wrote:
>> All char(n) types are stored on 4 byte boundaries, so char(1) costs up
>> to 8 bytes.
>
>Is this true for memory AND disk, or just memory?

Both.

>> Instead of char(1) you can use the Postgres specific type "char"
>> (*with* the quotes) which only needs one byte.
>
>So I assume use of this is 'safe'? Any degridation on performance?

I don't expect performance degradation;  this should rather improve
performance because with smaller tuples you get more tuples per page
and so pages have to be read/written less frequently.  AFAICT from my
tests, if your system is IO bound, then a reduction of tuple size
translates directly to performance improvement, e.g. 5% tuple size
reduction results more or less in 5% better throughput;  might be
less, if your usage pattern is CPU bound;  might be more, if you're
lucky and your working set jumps from just a bit more than available
cache to just a bit less.

Servus
 Manfred


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: unable to dump database, toast errors
Next
From: Tom Lane
Date:
Subject: Re: feature request - adding columns with default value