Creating a foreign key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

 


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux