Re: Foreign keys and indexes

Поиск
Список
Период
Сортировка
От Marc Compte
Тема Re: Foreign keys and indexes
Дата
Msg-id 46657C46.5090702@sigte.udg.es
обсуждение исходный текст
Ответ на Re: Foreign keys and indexes  (Richard Broersma Jr <rabroersma@yahoo.com>)
Ответы Re: Foreign keys and indexes  (Scott Marlowe <smarlowe@g2switchworks.com>)
Re: Foreign keys and indexes  (Oliver Elphick <olly@lfix.co.uk>)
Список pgsql-general
Thanks to everyone for the prompt reply :)

Good thing about answers is when they raise up new questiosn, so you can
keep on learning all the time.

This one answer, for instance, brings me another question. Does having a
composite primary mean the system will create an individual index on
each of the fields? or is the index created on the composition only?

For instance, in the implementation of a N:M relationship, declaring the
primary as (foreign1, foreign2) will create two indexes? or just one?

Thanks again

Marc Compte

En/na Richard Broersma Jr ha escrit:
>> Does PostgreSQL create an implicit index also for foreign keys? or must
>> I create it explicitly?
>>
>
> No, you foreign keys are not automatically indexed.  They only way they would be is if the FK is
> part of a composite unique or primary key.  So you will probably have to create your one indexes
> on FKs.
>
> Regards,
> Richard Broersma Jr.
>
>
>


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

Предыдущее
От: Greg Smith
Дата:
Сообщение: Re: Corruption of files in PostgreSQL
Следующее
От: Erwin Moller
Дата:
Сообщение: Re: TSEARCH2: disable stemming in indexes and triggers