December 2, 2009 at 5:35 am
Hi All,
I have built a smalll contact database with some 15 tables or so.
I have made some fields mandatory, and some unique. I have noticed that making a field mandatory and unique appears to crate an index. Is this correct?
Do I not need to create indexes for mandatory unique and primary key fields, just the other fields that I want indexed, such as surname etc?
Forgive the noobie question, but this is my first venture into building constraints and indexes into a database. I am doing thi sbecuase I am expecting some 800,000 records to be inserted.
Paul
December 2, 2009 at 5:50 am
Paul_Harvey (12/2/2009)
I have noticed that making a field mandatory and unique appears to crate an index. Is this correct?
Making a field unique creates an index. The mandatory part has nothing to do with it. The way that SQL enforces uniqueness (either unique constraint or primary key) is to create an index on that column or set of columns.
This series may be of use to you. http://www.sqlservercentral.com/articles/Indexing/68439/
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 2, 2009 at 6:09 am
Thank you. I'll read the articles.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply