Re: make a unique index for foreign keys?

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: make a unique index for foreign keys?
Дата
Msg-id GNELIHDDFBOCMGBFGEFOCELJCCAA.chriskl@familyhealth.com.au
обсуждение исходный текст
Ответ на Re: make a unique index for foreign keys?  ("Beth Gatewood" <beth@vizxlabs.com>)
Ответы Re: make a unique index for foreign keys?  ("Beth Gatewood" <beth@vizxlabs.com>)
Список pgsql-sql
> Thanks for the response and guidelines.  I think that I figured out
> something concerning indices and foreign keys...It seems like a non-unique
> index is automatically getting created for my foreign keys.  Does
> this make
> sense?

Hmm...nope.  Creating a foreign key doesn't create an index.  However,
creating a primary key does - sure you're not getting mixed up there?

> I got this hunch from this function I found while peeking through the
> archives today...
> pg_get_indexdef(oid);  // oid should be the oid of the index you are
> investigating
>
> Using this I discovered some indices on foreign keys that I didn't
> explicitly create.

Postgres doesn't create indices for you, unless as part of a primary key or
unique constraint.

Chris



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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Case insensitive select
Следующее
От: "isaac flemmin"
Дата:
Сообщение: Re: Case insensitive select