From: Josh Berkus <josh@agliodbs.com>
To: pierre@kahuna.versions.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Table design issue....
Date: Mon, 11 Jun 2001 12:09:41 -0700
Message-ID: <web-70353@davinci.ethosmedia.com> (raw)
In-Reply-To: <20010611175423.20147.qmail@kahuna.versions.com>
Pierre,
> In all honesty, I can't imagine ever having to join all of that
> tables at once.
> I had considered creating an attribute table previously, but was
> concerned
> about performance when working to retrieve large numbers of records.
A lot of optimization will be necessessary if you are talking over a
million records (or over 100,000 on a slow server). But spreading out
the data over several tables will force you to make a *lot* of LEFT
JOINs, which sure doesn't help your performance either.
> Perhaps, the best idea is the one I tried to not use, and that is a
> seperate
> table that contains a copy of all of the attribute's that have the
> specified type. sort of a lookaside table. I was just concenred with
> referential integrity.
Ah. I see what you're getting at. Why not use a view, rather than a
lookup table? I think that this might overcome your performance issues:
CREATE VIEW vw_table_attributes_C AS
SELECT tableid, attribute_type
FROM attributes
WHERE attribute_type = 'C'
GROUP BY tableid, attribute_type;
SELECT tableid, table_data
FROM tables JOIN vw_table__attributes_C USING tableid;
This prevents the duplication of data tables, plus gives you the
optimization inherent in a view. With regular VACUUM ANALYZE, this
should solve your perfromance problems.
-Josh
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. 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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com, pierre@kahuna.versions.com
Subject: Re: Table design issue....
In-Reply-To: <web-70353@davinci.ethosmedia.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