![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
If i create a simple table with a foreign key constraint, does it create an implicit index on that given ID? |
|
I've been told this is done in some databases, but i need to know for sure if SQL Server does it. Has anyone heard of this before, on any other databses perhaps? |
|
Heres an example of how the foreign key constraint is being added: ALTER TABLE [dbo].[administrators] WITH CHECK ADD CONSTRAINT [FPSLUFSUOXZGAJOJ] FOREIGN KEY([AdministratorRoleID]) REFERENCES [dbo].[administratorroles] ([AdministratorRoleID]) My initial testing seems to indicate adding an index on the foreign key column helps, but i need to know for sure. Any insight would be greatly appreciated! |
#3
| |||
| |||
|
|
I've been told this is done in some databases, .. |
#4
| |||
| |||
|
|
If i create a simple table with a foreign key constraint, does it create an implicit index on that given ID? I've been told this is done in some databases, but i need to know for sure if SQL Server does it. Has anyone heard of this before, on any other databses perhaps? Heres an example of how the foreign key constraint is being added: ALTER TABLE [dbo].[administrators] WITH CHECK ADD CONSTRAINT [FPSLUFSUOXZGAJOJ] FOREIGN KEY([AdministratorRoleID]) REFERENCES [dbo].[administratorroles] ([AdministratorRoleID]) My initial testing seems to indicate adding an index on the foreign key column helps, but i need to know for sure. Any insight would be greatly appreciated! Bob |
#5
| |||
| |||
|
|
Check with sysindexes to see if SQL Server does this too. |
|
On Fri, 21 Sep 2007 19:51:14 -0000, "bobdurie (AT) gmail (DOT) com" bobdurie (AT) gmail (DOT) com> wrote: Microsoft Access does this, when you create a relationship between two tables. Check with sysindexes to see if SQL Server does this too. -Tom. If i create a simple table with a foreign key constraint, does it create an implicit index on that given ID? I've been told this is done in some databases, but i need to know for sure if SQL Server does it. Has anyone heard of this before, on any other databses perhaps? Heres an example of how the foreign key constraint is being added: ALTER TABLE [dbo].[administrators] WITH CHECK ADD CONSTRAINT [FPSLUFSUOXZGAJOJ] FOREIGN KEY([AdministratorRoleID]) REFERENCES [dbo].[administratorroles] ([AdministratorRoleID]) My initial testing seems to indicate adding an index on the foreign key column helps, but i need to know for sure. Any insight would be greatly appreciated! Bob |
#6
| |||
| |||
|
|
If i create a simple table with a foreign key constraint, does it create an implicit index on that given ID? I've been told this is done in some databases, but i need to know for sure if SQL Server does it. Has anyone heard of this before, on any other databses perhaps? Heres an example of how the foreign key constraint is being added: ALTER TABLE [dbo].[administrators] WITH CHECK ADD CONSTRAINT [FPSLUFSUOXZGAJOJ] FOREIGN KEY([AdministratorRoleID]) REFERENCES [dbo].[administratorroles] ([AdministratorRoleID]) My initial testing seems to indicate adding an index on the foreign key column helps, but i need to know for sure. Any insight would be greatly appreciated! Bob |
#7
| |||
| |||
|
|
Also, analyse your query requirements then apply an Indexing Strategy -- Jack Vamvas ___________________________________ Need an IT job? http://www.ITjobfeed.com/SQL bobdu... (AT) gmail (DOT) com> wrote in message news:1190404274.471197.197240 (AT) n39g2000hsh (DOT) googlegroups.com... If i create a simple table with a foreign key constraint, does it create an implicit index on that given ID? I've been told this is done in some databases, but i need to know for sure if SQL Server does it. Has anyone heard of this before, on any other databses perhaps? Heres an example of how the foreign key constraint is being added: ALTER TABLE [dbo].[administrators] WITH CHECK ADD CONSTRAINT [FPSLUFSUOXZGAJOJ] FOREIGN KEY([AdministratorRoleID]) REFERENCES [dbo].[administratorroles] ([AdministratorRoleID]) My initial testing seems to indicate adding an index on the foreign key column helps, but i need to know for sure. Any insight would be greatly appreciated! Bob |

![]() |
| Thread Tools | |
| Display Modes | |
| |