Indexes on inheriting tables

From: Toby Corkindale <toby(dot)corkindale(at)strategicdata(dot)com(dot)au>
To: pgsql-general(at)postgresql(dot)org
Subject: Indexes on inheriting tables
Date: 2011-08-25 01:17:57
Message-ID: 4E55A2C5.4050803@strategicdata.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I'm using Pg 9.0 and inheritance to do table partitioning.

A simple example would be:
CREATE TABLE foo (
id INTEGER PRIMARY KEY,
thing VARCHAR(32)
);
CREATE INDEX foo_thing_idx ON foo(thing);
CREATE TABLE foo_1 () INHERITS (foo);

I read that foreign key constraints wouldn't be inherited. However I am
also finding that indexes aren't inherited either.

eg. EXPLAIN SELECT id FROM foo WHERE thing='something';
will indicate that an indexed scan will be done over foo, followed by a
sequential scan over foo_1.

Do I need to make sure I re-create every index on every child table I
create?
That would be.. annoying, at best.

Is there a way to enable inheritance of indexes too?

Cheers,
Toby

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shoaib Mir 2011-08-25 01:34:27 Re: Indexes on inheriting tables
Previous Message mark 2011-08-25 00:43:22 Re: how is max_fsm_pages configured in 8.4