Re: 1 char in the world

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matt Mello <alien(at)spaceship(dot)com>
Cc: pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: 1 char in the world
Date: 2003-01-29 23:59:26
Message-ID: 5513.1043884766@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Matt Mello <alien(at)spaceship(dot)com> writes:
> Is that true if I have a table that consists of lots of 1-char fields?
> For example, if I have a table with 4 billion records, which consist of
> (20) 1-char fields each, then the storage for the data will be something
> like 5 times as large if I use TEXT than if I use "char".

Probably more like 8 times as large, when you allow for alignment
padding --- on most machines, TEXT fields will be aligned on 4-byte
boundaries, so several TEXT fields in a row will take up 8 bytes apiece,
vs one byte apiece for consecutive "char" or bool fields.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Andras Kadinger 2003-01-30 01:02:49 Re: Query plan and Inheritance. Weird behavior
Previous Message Matt Mello 2003-01-29 23:29:58 Re: 1 char in the world