pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matt Mello <alien@spaceship.com>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: 1 char in the world
Date: Wed, 29 Jan 2003 18:59:26 -0500
Message-ID: <5513.1043884766@sss.pgh.pa.us> (raw)
In-Reply-To: <3E3863F6.2020004@spaceship.com>
References: <3E37733D.90205@spaceship.com>
	<1043842700.5008.11.camel@huli>
	<3E3863F6.2020004@spaceship.com>

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



view thread (7+ messages)  latest in thread

Message-ID: <5513.1043884766@sss.pgh.pa.us>
Permalink:  ../5513.1043884766@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5513.1043884766@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alien@spaceship.com
  Subject: Re: 1 char in the world
  In-Reply-To: <5513.1043884766@sss.pgh.pa.us>
  References: <3E37733D.90205@spaceship.com> <1043842700.5008.11.camel@huli> <3E3863F6.2020004@spaceship.com> <5513.1043884766@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox