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 0E978329E46 for ; Fri, 8 Oct 2004 03:43:39 +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 40814-09 for ; Fri, 8 Oct 2004 02:43:37 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4B850329E42 for ; Fri, 8 Oct 2004 03:43:35 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id i982hXd3027540; Thu, 7 Oct 2004 22:43:33 -0400 (EDT) To: josh@agliodbs.com Cc: pgsql-performance@postgresql.org, Gabriele Bartolini , "Aaron Werman" Subject: Re: Data warehousing requirements In-reply-to: <200410071550.20665.josh@agliodbs.com> References: <6.1.2.0.2.20041006230239.0201bd40@box.tin.it> <6.1.2.0.2.20041007183909.0201f310@box.tin.it> <200410071550.20665.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Thu, 07 Oct 2004 15:50:20 -0700" Date: Thu, 07 Oct 2004 22:43:33 -0400 Message-ID: <27539.1097203413@sss.pgh.pa.us> From: Tom Lane 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/92 X-Sequence-Number: 8568 Josh Berkus writes: > 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. Uh ... not true. The column will not be stored, either way. Now if you had a row that otherwise had no nulls, the first null in the column will cause a null-columns-bitmap to be added, which might more than eat up the savings from storing a single int or bigint. But after the first null, each additional null in a row is a win, free-and-clear, whether it's fixed-width or not. (There are also some alignment considerations that might cause the savings to vanish.) > 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. It's not so much that they are necessarily inefficient as that they constrain the planner's freedom of action. You need to think a lot more carefully about the order of joining than when you use inner joins. regards, tom lane