Re: 1 char in the world - Mailing list pgsql-performance

From Tom Lane
Subject Re: 1 char in the world
Date
Msg-id 5513.1043884766@sss.pgh.pa.us
Whole thread Raw
In response to Re: 1 char in the world  (Matt Mello <alien@spaceship.com>)
List pgsql-performance
Matt Mello <alien@spaceship.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

pgsql-performance by date:

Previous
From: Matt Mello
Date:
Subject: Re: 1 char in the world
Next
From: Andras Kadinger
Date:
Subject: Re: Query plan and Inheritance. Weird behavior