Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id CD6C82E1652 for ; Sat, 2 Feb 2008 02:37:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 30516-03 for ; Sat, 2 Feb 2008 02:37:11 -0400 (AST) Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 269582E02D7 for ; Sat, 2 Feb 2008 02:37:13 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 70F1F564D7; Sat, 2 Feb 2008 06:37:11 +0000 (UTC) Received: (hashcash-sendmail, from uid 1001); Sat, 2 Feb 2008 00:37:09 -0600 Date: Sat, 2 Feb 2008 00:37:09 -0600 From: Decibel! To: "Gangadharan S.A." Cc: pgsql-performance@postgresql.org Subject: Re: Storage space usage Message-ID: <20080202063709.GR1212@decibel.org> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tpcaav3s83TeuU58" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.1-RELEASE-p10 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.13 (2006-08-11) X-Hashcash: 1:20:080202:gangadharan@gmail.com::RZWoRh31svqynDKF:0000000000000000 0000000000000000000000002UW8 X-Hashcash: 1:20:080202:pgsql-performance@postgresql.org::Os0eTVV5W17lqpc2:00000 00000000000000000000000049qk X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/2 X-Sequence-Number: 28544 --tpcaav3s83TeuU58 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 01, 2008 at 02:14:18PM +0530, Gangadharan S.A. wrote: > Hi, > I have 2 questions regarding the storage optimization done by Postgres: > 1) Is a NULL value optimized for storage. If I have a timestamp (or some > such) field that I set to default NULL, will it still use up the full spa= ce > for the data type. Null values are indicated via a NULL bitmap. A null field is not stored, it is just indicated in the bitmap. > 2) Similarly, if I have a text array, is an empty array optimized for > storage? Arrays are stored as varlenas. I'm pretty sure than an empty array is considered to be NULL; as such the comments above would apply. --=20 Decibel!, aka Jim C. Nasby, Database Architect decibel@decibel.org=20 Give your computer some brain candy! www.distributed.net Team #1828 --tpcaav3s83TeuU58 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.3 (FreeBSD) iD8DBQFHpA+VdO30qud8SkgRAtrxAJ96JocbR7OXXd92TU2Wgrl8lZ4JbgCfaEnM B562Uxm8XzseYcIH+NRm/0g= =gbxx -----END PGP SIGNATURE----- --tpcaav3s83TeuU58--