Your performance is suffering and you want to check if your constraints are still trusted
This can be the case with import scripts. A script can disable the checks, import and than enable the checks again. If something goes wrong...
Use use the following query on your database to find information about your foreign keys. The "is_not_trusted" should be 0. When this is not the case, you have a problem and should correct it. Untrusted foreign keys can cause performance problems because the query analyser has to build the checks into the query plan.
select name, type_desc, is_not_trusted from sys.foreign_keys
To correct this, you need to alter the table.
alter table table_name with check check constraint constraint_name
About the Author
Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux in different European countries and different European languages. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform where he is one of the most important contributors and the main developer.