From: Tom Lane <tgl@sss.pgh.pa.us>
To: josh@agliodbs.com
Cc: pgsql-performance@postgresql.org, Gabriele Bartolini <angusgb@tin.it>
Cc: Aaron Werman <awerman2@hotmail.com>
Subject: Re: Data warehousing requirements
Date: Thu, 07 Oct 2004 22:43:33 -0400
Message-ID: <27539.1097203413@sss.pgh.pa.us> (raw)
In-Reply-To: <200410071550.20665.josh@agliodbs.com>
References: <6.1.2.0.2.20041006230239.0201bd40@box.tin.it>
<BAY18-DAV8suot0OUIH00003354@hotmail.com>
<6.1.2.0.2.20041007183909.0201f310@box.tin.it>
<200410071550.20665.josh@agliodbs.com>
Josh Berkus <josh@agliodbs.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, josh@agliodbs.com, angusgb@tin.it, awerman2@hotmail.com
Subject: Re: Data warehousing requirements
In-Reply-To: <27539.1097203413@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox