Re: [OT] "advanced" database design (long) - Mailing list pgsql-general

From ptjm@interlog.com (Patrick TJ McPhee)
Subject Re: [OT] "advanced" database design (long)
Date
Msg-id 13qfnp53p5osaeb@corp.supernews.com
Whole thread Raw
In response to [OT] "advanced" database design (long)  (vladimir konrad <vk@dsl.pipex.com>)
List pgsql-general
In article <33c6269f0802032014i3878ec3co4488b4835ef1e3d8@mail.gmail.com>,
Alex Turner <armtuk@gmail.com> wrote:
%
% I"m not a database expert, but wouldn't
%
% create table attribute (
%   attribute_id int
%   attribute text
% )
%
% create table value (
%   value_id int
%   value text
% )
%
% create table attribute_value (
%   entity_id int
%   attribute_id int
%   value_id int
% )
%
% give you a lot less  pages to load than building a table with say 90 columns
% in it that are all null, which would result in better rather than worse
% performance?

Suppose you want one row of data. Say it's one of the ones where the
columns aren't all nulls. You look up 90 rows in attribute_value, then
90 rows in attribute, then 90 rows in value. You're probably looking at
3-6 pages of index data, and then somewhere between 3 and 270 pages of
data from the database, for one logical row of data.
--

Patrick TJ McPhee
North York  Canada
ptjm@interlog.com

pgsql-general by date:

Previous
From: Vivek Khera
Date:
Subject: Re: [pgsql-advocacy] PostgreSQL Certification
Next
From: Benjamin Arai
Date:
Subject: Continual uptime while loading data ... COPY vs INSERTS within a transaction.