Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g02JRKm13484 for ; Wed, 2 Jan 2002 14:27:21 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id g02J0ql57067 for pgsql-admin@postgresql.org; Wed, 2 Jan 2002 14:00:52 -0500 (EST) (envelope-from news) From: reina@nsi.edu (Tony Reina) X-Newsgroups: comp.databases.postgresql.admin Subject: Inherited tables vs non-inherited tables Date: 2 Jan 2002 11:00:48 -0800 Organization: http://groups.google.com/ Lines: 46 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-abuse@google.com To: pgsql-admin@postgresql.org X-Archive-Number: 200201/2 X-Sequence-Number: 2891 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