Thread: indexes and inheritance

indexes and inheritance

From
Edwin Grubbs
Date:
I have been unable to get indexes to be used when selecting from a parent
table. I have tried running VACUUM ANALYZE and looking through the
documentation, and the indexes are used fine if I select from a single
table.

Example:

create table parent (name text);
create table child (age int4) inherits (parent);
create index parent_index on parent (name);
create index child_index on child (name);

.. fill with data ..

This select will not use the index for the "name" column:

SELECT *
FROM parent*
WHERE name = 'bob';

But if I replace "parent*" with "parent" or "child", this query uses the
appropriate index.

-Edwin