Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 43D519FB21D for ; Wed, 4 Oct 2006 20:36:19 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 66231-06 for ; Wed, 4 Oct 2006 23:36:12 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from localhost.localdomain (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id A51EC9FB203 for ; Wed, 4 Oct 2006 20:36:11 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=localhost.localdomain) by localhost.localdomain with esmtp (Exim 4.62) (envelope-from ) id 1GVGHa-0000mP-4o; Wed, 04 Oct 2006 19:36:10 -0400 From: Gregory Stark To: "Greg Sabino Mullane" Cc: pgsql-hackers@postgresql.org Subject: Re: Netflix Prize data In-Reply-To: <306b3b90a0fa1014e09717b77cca886b@biglumber.com> (Greg Sabino Mullane's message of "Wed, 4 Oct 2006 22:34:52 -0000") Organization: EnterpriseDB References: <306b3b90a0fa1014e09717b77cca886b@biglumber.com> X-Draft-From: ("nnimap+webmail.enterprisedb.com:Inbox" 4636) Date: Wed, 04 Oct 2006 19:36:09 -0400 Message-ID: <87hcyj64d2.fsf@enterprisedb.com> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/259 X-Sequence-Number: 92156 "Greg Sabino Mullane" writes: > CREATE TABLE rating ( > movie SMALLINT NOT NULL, > person INTEGER NOT NULL, > rating SMALLINT NOT NULL, > viewed DATE NOT NULL > ); You would probably be better off putting the two smallints first followed by the integer and date. Otherwise both the integer and the date field will have an extra two bytes of padding wasting 4 bytes of space. If you reorder the fields that way you'll be down to 28 bytes of tuple header overhead and 12 bytes of data. There's actually another 4 bytes in the form of the line pointer so a total of 44 bytes per record. Ie, almost 73% of the disk i/o you're seeing is actually per-record overhead. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com