I need to alter a large table in order to add a foreign key. Does adding the constraint cause the table to be rebuilt? The referenced table already exists and has an index on the column.
Asked
Active
Viewed 839 times
2
-
1probably better served over at DBA exchange. – Daniel Widrick Sep 20 '13 at 21:12
-
@lVlint67 not necessarily. Things can be on-topic in more than one place. If something is on topic here, we shouldn't be shoving people around to other sites because it's in topic there as well. – MDMarra Sep 20 '13 at 22:16
1 Answers
1
No, so long as the column types are identical, as well as the index definitions.
That said, attempting to define a foreign key constraint on two indexes that differ will fail and you'll have to alter the tables and/or build/rebuild the indexes manually.

Sammitch
- 2,111
- 1
- 21
- 35