From: reina@nsi.edu
To: pgsql-admin@postgresql.org
Subject: Inherited tables vs non-inherited tables
Date: 2 Jan 2002 11:00:48 -0800
Message-ID: <f40d3195.0201021100.a6641fa@posting.google.com> (raw)
I've been trying an inherited-table schema for my database and seem to
be getting a performance hit. The old table looked like this:
CREATE TABLE center_out (
subject text,
arm char,
target int4,
rep int4,
success int2, -- end of primary key
exp_date date,
exp_time time,
inter_target_radius int4,
target_radius int4);
Since the fields subject, arm, target, and rep appeared in just about
every other table as the primary key, I made it an inherited table for
the new schema:
CREATE TABLE center_out (
subject text,
arm char,
target int2,
rep int4,
success int2
);
CREATE UNIQUE INDEX pkcenter_out ON center_out (subject, arm, target,
rep, success);
CREATE TABLE center_out_behavior (
exp_date date,
exp_time time,
inter_target_radius int2,
target_radius int2
) INHERITS (center_out);
However, queries such as "SELECT DISTINCT subject FROM center_out"
seem to take 2-3 times longer in the new schema. Does this make sense?
I was hoping that the inherited information would lead to an
easier-to-follow, smaller, and faster database since there wouldn't be
redundant information across tables.
Thanks.
-Tony
PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.96
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-admin@postgresql.org
Cc: reina@nsi.edu
Subject: Re: Inherited tables vs non-inherited tables
In-Reply-To: <f40d3195.0201021100.a6641fa@posting.google.com>
References: <f40d3195.0201021100.a6641fa@posting.google.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