What are the challenges you face when working across database platforms? Take the survey

Disabling foreign keys

What are the advantages of using the option "Disable foreign keys"?

I really don't want *any* inconsistent data in my databases, so I don't want any NO CHECKS on any of the columns. What I have been doing in the past is doing data compares with "Disable foreign keys" on, and then running a script to turn get rid of all NO CHECKS.

It seems that if I don't use "Disable foreign keys" I don't get the NO CHECK issue, but there is a chance the data update will fail. That's ok by me, as I said I don't want any inconsistent data.

So is there any other advantage to using "Disable foreign keys"? I think it might make a performance difference if there is a lot of of data, does anyone know?


  • Options
    Thanks for your post.

    Apart from the points you already mentioned, the only other advantage I can think of is if you are only synchronising specific tables. You would probably require this option to be set if one of the tables included in the sync has a foreign key relationship to a table not being compared.

    Adding the NO CHECK to the scripts is designed to increase the performance, as validating every row can be fairly time consuming. We have an open feature request that has been approved for a future version which will enable you to create scripts with or without NO CHECK. For your reference the feature tracking code is SDC-818.
Sign In or Register to comment.