From: Josh Berkus <josh@agliodbs.com>
To: Francisco J Reyes <fran@natserv.net>
To: Ron Johnson <ron.l.johnson@cox.net>
Cc: PostgreSQL performance <pgsql-performance@postgresql.org>
Subject: Re: How number of columns affects performance
Date: Fri, 1 Aug 2003 10:44:03 -0700
Message-ID: <200308011044.03493.josh@agliodbs.com> (raw)
In-Reply-To: <20030801130507.M93127@zoraida.natserv.net>
References: <20030801115257.I92555@zoraida.natserv.net>
<1059755687.7508.638.camel@haggis>
<20030801130507.M93127@zoraida.natserv.net>
Francisco,
> Yes all fields belong to the same entity. I used 100 as an example it may
> be something like 60 to 80 fields (there are two tables in question). I
> don't formally do 3rd normal form, but for the most part I do most of
> the general concepts of normalization.
>
> > If not, then good design says to split the table.
Actually, no, it doesn't. If all 60-80 fields are unitary and required
characteristics of the row-entity, normalization says keep them in one table.
The only time NF would recommend splitting the table is for fields which are
frequenly NULL for reasons other than missing data entry. For those, you'd
create a child table. Although while this is good 4NF, it's impractical in
PostgreSQL, where queries with several LEFT OUTER JOINs tend to be very slow
indeed.
My attitude toward these normalization vs. performance issues is consistenly
the same: First, verify that you have a problem. That is, build the
database with everything in one table (or with child tables for Nullable
fields, as above) and try to run your application. If performance is
appalling, *then* take denormalization steps to improve it.
I'm frequently distressed by the number of developers who make questionable
design decisions "for performance reasons" without every verifying that they
were, in fact, improving performance ...
--
Josh Berkus
Aglio Database Solutions
San Francisco
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: josh@agliodbs.com, fran@natserv.net, ron.l.johnson@cox.net
Subject: Re: How number of columns affects performance
In-Reply-To: <200308011044.03493.josh@agliodbs.com>
References: <20030801115257.I92555@zoraida.natserv.net> <1059755687.7508.638.camel@haggis> <20030801130507.M93127@zoraida.natserv.net> <200308011044.03493.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