Creating a foreign key

Поиск
Список
Период
Сортировка
От Campbell, Lance
Тема Creating a foreign key
Дата
Msg-id B10E6810AC2A2F4EA7550D072CDE8760CDDD46@SAB-FENWICK.sab.uiuc.edu
обсуждение исходный текст
Ответы Re: Creating a foreign key  ("Joshua D. Drake" <jd@commandprompt.com>)
Re: Creating a foreign key  (Shaun Thomas <sthomas@leapfrogonline.com>)
Re: Creating a foreign key  (PFC <lists@peufeu.com>)
Список pgsql-performance

PostgreSQL: 8.2

 

When you create a foreign key to a table is there an index that is created on the foreign key automatically?

 

Example:

Table A has a field called ID.

 

Table B has a field called fk_a_id which has a constraint of being a foreign key to table A to field ID.

 

Is there an index automatically created on field fk_a_id in table B when I create a foreign key constraint?

 

 

I assume yes.  But I wanted to check.  I did not see it specifically mentioned in the documentation.

 

I also see “CREATE TABLE / PRIMARY KEY will create implicit index” when creating a primary key but I don’t see any similar statement when creating a foreign key.

 

Thanks,

 

Lance Campbell

Project Manager/Software Architect

Web Services at Public Affairs

University of Illinois

217.333.0382

http://webservices.uiuc.edu

 

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

Предыдущее
От: Justin
Дата:
Сообщение: Re: [GENERAL] Ubuntu question
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Creating a foreign key