dbTalk Databases Forums  

indexes and constraints

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss indexes and constraints in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
hayko98
 
Posts: n/a

Default indexes and constraints - 12-14-2009 , 04:42 PM






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

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: indexes and constraints - 12-14-2009 , 04:54 PM






hayko98 (vardan.hakopian (AT) gmail (DOT) com) writes:
Quote:
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?
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, esquel (AT) sommarskog (DOT) 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/prodinf...ons/books.mspx

Reply With Quote
  #3  
Old   
--CELKO--
 
Posts: n/a

Default Re: indexes and constraints - 12-15-2009 , 08:15 PM



Quote:
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.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.