pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: jim@nasby.net
To: pgsql-performance@postgresql.org
Subject: Re: How are null's stored?
Date: Mon, 12 May 2003 13:44:43 -0700
Message-ID: <200305121344.43288.josh@agliodbs.com> (raw)
In-Reply-To: <20030512190156.GA40542@flake.decibel.org>
References: <20030512190156.GA40542@flake.decibel.org>

Jim,

> I have a 40M row table I need to import data into, then use to create a
> bunch of more normalized tables. Right now all fields are varchar, but
> I'm going to change this so that fields that are less than a certain
> size are just char. Question is, how much impact is there from char
> being nullable vs. not nullable? src/include/access/htup.h indicates
> that nulls are stored in a bitmap, so I'd suspect that I should see a
> decent space savings from not having to include length information all
> the time... (most of these small fields are always the same size no
> matter what...)

This is moot.   PostgreSQL stores CHAR(x), VARCHAR, and TEXT in the same 
internal format, which includes length information in the page header.   So 
you save no storage space by converting to CHAR(x) ... you might even make 
your tables *larger* because of the space padding.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco




view thread (9+ messages)  latest in thread

Message-ID: <200305121344.43288.josh@agliodbs.com>
Permalink:  ../200305121344.43288.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200305121344.43288.josh@agliodbs.com

 · 

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: josh@agliodbs.com, jim@nasby.net
  Subject: Re: How are null's stored?
  In-Reply-To: <200305121344.43288.josh@agliodbs.com>
  References: <20030512190156.GA40542@flake.decibel.org> <200305121344.43288.josh@agliodbs.com>

* 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