X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BB012476315 for ; Mon, 12 May 2003 16:45:12 -0400 (EDT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id D05D84762F6 for ; Mon, 12 May 2003 16:45:11 -0400 (EDT) Received: from [216.135.165.74] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3028475; Mon, 12 May 2003 13:45:09 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: jim@nasby.net, pgsql-performance@postgresql.org Subject: Re: How are null's stored? Date: Mon, 12 May 2003 13:44:43 -0700 User-Agent: KMail/1.4.3 References: <20030512190156.GA40542@flake.decibel.org> In-Reply-To: <20030512190156.GA40542@flake.decibel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200305121344.43288.josh@agliodbs.com> X-Spam-Status: No, hits=-32.4 required=5.0 tests=BAYES_01,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_KMAIL autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/130 X-Sequence-Number: 1909 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=20 internal format, which includes length information in the page header. So= =20 you save no storage space by converting to CHAR(x) ... you might even make= =20 your tables *larger* because of the space padding. --=20 -Josh Berkus Aglio Database Solutions San Francisco