pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-performance@postgresql.org
Cc: Gabriele Bartolini <angusgb@tin.it>
Cc: Aaron Werman <awerman2@hotmail.com>
Subject: Re: Data warehousing requirements
Date: Thu, 7 Oct 2004 15:50:20 -0700
Message-ID: <200410071550.20665.josh@agliodbs.com> (raw)
In-Reply-To: <6.1.2.0.2.20041007183909.0201f310@box.tin.it>
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>

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



view thread (9+ messages)  latest in thread

Message-ID: <200410071550.20665.josh@agliodbs.com>
Permalink:  ../200410071550.20665.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200410071550.20665.josh@agliodbs.com

 · 

reply

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: josh@agliodbs.com, angusgb@tin.it, awerman2@hotmail.com
  Subject: Re: Data warehousing requirements
  In-Reply-To: <200410071550.20665.josh@agliodbs.com>

* 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