X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8214C32A0A4 for ; Thu, 7 Oct 2004 23:48:41 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40301-10 for ; Thu, 7 Oct 2004 22:48:37 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id 7628F32A04B for ; Thu, 7 Oct 2004 23:48:38 +0100 (BST) Received: from [64.81.245.111] (account josh@agliodbs.com HELO temoku.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6473573; Thu, 07 Oct 2004 15:50:01 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Data warehousing requirements Date: Thu, 7 Oct 2004 15:50:20 -0700 User-Agent: KMail/1.6.2 Cc: Gabriele Bartolini , "Aaron Werman" References: <6.1.2.0.2.20041006230239.0201bd40@box.tin.it> <6.1.2.0.2.20041007183909.0201f310@box.tin.it> In-Reply-To: <6.1.2.0.2.20041007183909.0201f310@box.tin.it> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200410071550.20665.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/90 X-Sequence-Number: 8566 Gabriele, > That's another interesting argument. Again, I had in mind the space > efficiency principle and I decided to use null IDs for dimension tables if > I don't have the information. I noticed though that in those cases I can't > use any index and performances result very poor. For one thing, this is false optimization; a NULL isn't saving you any table size on an INT or BIGINT column. NULLs are only smaller on variable-width columns. If you're going to start counting bytes, make sure it's an informed count. More importantly, you should never, ever allow null FKs on a star-topology database. LEFT OUTER JOINs are vastly less efficient than INNER JOINs in a query, and the difference between having 20 outer joins for your data view, vs 20 regular joins, can easily be a difference of 100x in execution time. -- --Josh Josh Berkus Aglio Database Solutions San Francisco