X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F04AF9DCDE9 for ; Fri, 3 Mar 2006 06:24:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20240-05 for ; Fri, 3 Mar 2006 06:24:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svana.org (svana.org [125.62.94.225]) by postgresql.org (Postfix) with ESMTP id 696F19DCDDD for ; Fri, 3 Mar 2006 06:23:58 -0400 (AST) Received: from kleptog by svana.org with local (Exim 4.50) id 1FF7S2-0004cD-Sy; Fri, 03 Mar 2006 21:23:58 +1100 Date: Fri, 3 Mar 2006 11:23:58 +0100 From: Martijn van Oosterhout To: Paul Mackay Cc: pgsql-general@postgresql.org Subject: Re: Physical column size Message-ID: <20060303102358.GA17615@svana.org> Reply-To: Martijn van Oosterhout Mail-Followup-To: Paul Mackay , pgsql-general@postgresql.org References: <786c2f6d0601260206k2201a548p48af7c7fc085d3b2@mail.gmail.com> <786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Kj7319i9nmIyA2yE" Content-Disposition: inline In-Reply-To: <786c2f6d0603030203m3b7c62a1k6950ceca066dc5ce@mail.gmail.com> X-PGP-Key-ID: Length=1024; ID=0x0DC67BE6 X-PGP-Key-Fingerprint: 295F A899 A81A 156D B522 48A7 6394 F08A 0DC6 7BE6 X-PGP-Key-URL: User-Agent: Mutt/1.5.9i X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kleptog@svana.org X-SA-Exim-Scanned: No (on svana.org); SAEximRunCond expanded to false X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.123 required=5 tests=[AWL=0.123] X-Spam-Score: 0.123 X-Spam-Level: X-Archive-Number: 200603/116 X-Sequence-Number: 91981 --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 03, 2006 at 11:03:24AM +0100, Paul Mackay wrote: > The end result is that the physical size on disk used by table tmp_A is > exactly the same as table tmp_B (as revealed by the pg_relation_size > function) ! Given that a "char" field is supposed to be 1 byte in size an= d a > int4 4 bytes, shouldn't the tmp_A use a smaller disk space ? Or is it that > any value, whatever the type, requires at least 4 bytes to be stored ? Alignment. An int4 value must start on a multiple of 4 offset, so you get three bytes of padding. If you put the int4, then the char it should work better. Although whole rows have alignment requirements too... Have a nice day, --=20 Martijn van Oosterhout http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them. --Kj7319i9nmIyA2yE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFECBk+IB7bNG8LQkwRAslJAJoCnKxll9qL0qXuTkVhSWFbi9DkSACdFOM0 AQ+88oEq51dsSAiSPdmFcbc= =wXvW -----END PGP SIGNATURE----- --Kj7319i9nmIyA2yE--