Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

indexes and constraints

1 view
Skip to first unread message

hayko98

unread,
Dec 14, 2009, 5:42:39 PM12/14/09
to
Hi.
I am inserting data into 3 tables. Before I insert, I am dropping some
of the constrains. After inserting the data I added dropped
constrains back .Most of the constraints that I added I did not
specify WITH CHECK or WITH NOCHECK.5 Of them I used WITH NOCKECK.My
question is how would this adding and dropping constrains effect to
indexes and performence?.Do I have to reindex them?


Thank you

Erland Sommarskog

unread,
Dec 14, 2009, 5:54:29 PM12/14/09
to

When it comes to UNIQUE and PRIMARY KEY constraints, NOCHECK has no
effect.

For FOREIGN KEYS and CHECK constraints, using NOCHECK means that SQL
Server does not verify that data in the table complies with the constraint.
This has the implication that the optimizer cannot trust the constraint,
and this could have an impact on performance.


--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

--CELKO--

unread,
Dec 15, 2009, 9:15:36 PM12/15/09
to
>> My question is how would this adding and dropping constraints effect to indexes and performance?. <<

This is not the problem. You will eventually have no data integrity
if you keep doing this. This is like thinking you can improve gas
mileage by making the car lighter -- by removing all the safety
features.

0 new messages