index not used with inherited tables

Поиск
Список
Период
Сортировка
Искать
От
Verena Ruff
Тема
index not used with inherited tables
Дата
в 12:20:20
Msg-id
4461E4D4.30708@triosolutions.at
Список
Дерево обсуждения
index not used with inherited tables Verena Ruff <lists@triosolutions.at>
Re: index not used with inherited tables Sean Davis <sdavis2@mail.nih.gov>
Re: index not used with inherited tables Verena Ruff <lists@triosolutions.at>
Re: index not used with inherited tables Tom Lane <tgl@sss.pgh.pa.us>
Re: index not used with inherited tables Verena Ruff <lists@triosolutions.at>
Hi,

there is a table person, which has some child tables. the definition 
(part of):

CREATE TABLE person
(
  pers_id serial NOT NULL,
  -- some other fields --
  CONSTRAINT person_pk PRIMARY KEY (pers_id)
)

one of these child tables is mitarbeiter:
CREATE TABLE mitarbeiter
(
  -- some fields --
  CONSTRAINT pers_id_pk_mitarbeiter PRIMARY KEY (pers_id)
) INHERITS (person)

as you see the inherited column pers_id is used as primary key in the 
child table as well. if I do
EXPLAIN SELECT * FROM mitarbeiter WHERE pers_id=7; I see that PostgreSQL 
does a seq scan on mitarbeiter instead of an index scan. There are some 
other child tables and it seems like in some cases the index is used, in 
others not, but I have no idea why.

Any hints?

Regards,
Verena
В списке pgsql-novice по дате отправления
От: Sean Davis
Дата:
Сообщение: Re: error handling
От: Sean Davis
Дата:
FAQ