Re: Single Byte values

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Jason Hihn <jhihn(at)paytimepayroll(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Single Byte values
Date: 2003-04-04 15:45:12
Message-ID: lp8r8vot69rspsmfo1mj217e0071u8pjv1@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 04 Apr 2003 09:13:54 -0500, Jason Hihn
<jhihn(at)paytimepayroll(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-04-04 15:47:28 Re: unable to dump database, toast errors
Previous Message Stephan Szabo 2003-04-04 15:42:31 Re: Badly planned queries with JOIN syntax