X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4515C47580B for ; Mon, 12 May 2003 16:53:07 -0400 (EDT) Received: from t-9.net (unknown [64.246.36.43]) by postgresql.org (Postfix) with SMTP id D6B0F476352 for ; Mon, 12 May 2003 16:53:03 -0400 (EDT) Received: (qmail 29160 invoked by uid 0); 12 May 2003 18:58:03 -0000 Received: from localhost (HELO seahat.com) (127.0.0.1) by localhost with SMTP; 12 May 2003 18:58:03 -0000 Received: from 65.102.128.233 (SquirrelMail authenticated user snubber@seahat.com) by fordparts.com with HTTP; Mon, 12 May 2003 13:58:03 -0500 (CDT) Message-ID: <10995.65.102.128.233.1052765883.squirrel@fordparts.com> Date: Mon, 12 May 2003 13:58:03 -0500 (CDT) Subject: Re: How are null's stored? From: "Ryan" To: In-Reply-To: <200305121344.43288.josh@agliodbs.com> References: <20030512190156.GA40542@flake.decibel.org> <200305121344.43288.josh@agliodbs.com> X-Priority: 3 Importance: Normal Cc: X-Mailer: SquirrelMail (version 1.2.8) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-25.1 required=5.0 tests=BAYES_01,IN_REP_TO,MSG_ID_ADDED_BY_MTA_3,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES 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/131 X-Sequence-Number: 1910 > 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. So if the internal format is identical, why does the INFERNAL database ignore indexes when you have a text compared to a varchar? Ryan