2

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.

  • 1
    probably 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
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.