Re: Foreign keys

Поиск
Список
Период
Сортировка
От Jeremy Semeiks
Тема Re: Foreign keys
Дата
Msg-id 20040827190237.GY29207@farviolet.farviolet.com
обсуждение исходный текст
Ответ на Foreign keys  (Steve Tucknott <steve@retsol.co.uk>)
Ответы Re: Foreign keys  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
On Fri, Aug 27, 2004 at 09:31:51AM +0100, Steve Tucknott wrote:
> PostGreSql 7.4.3
>
> Am I right in assuming that a foreign key on a table does not explicity
> create an index on that column on the foreign table? I can see via the
> \d on the table that the foreign key exists, but accessing the table on
> that column seems to use a sequential scan.

Adding the foreign key won't add the index itself, but I believe that
foreign keys can only be declared on columns declared unique.
Since declaring columns unique implicitly creates an index on them, if
you can legally declare the foreign key then "\d" should show that
the foreign key's index already exists.

It sounds like sequential scan is being used for a completely
unrelated reason.

- Jeremy

В списке pgsql-novice по дате отправления:

Предыдущее
От: Doug Silver
Дата:
Сообщение: Tracking down "idle in transaction" processes
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Foreign keys