dbTalk Databases Forums  

Index design

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


Discuss Index design in the comp.databases.ms-sqlserver forum.



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

Default Index design - 11-09-2007 , 02:52 AM






I have a large table with an unique integer primary key and many coloums
I have various programs to calculate many satistical information, this
programs use many stored procedures.
In other words many select statement query on the same table with where
clause on all combinations for the coloums.
Now I must create index
Initially i was create cluster primary key and many index on datatime
field and one other coloumn
But now I ask: If I create an index with all coloumns, it is used by
sqlserver for speed the query who use only 1, or 2 coloumns only?
....and it is better to make this index clustered (and not the primary key?)
I'm reading various sqlserver manual to know the index policy but I
can't to understand how to do this!!!
Can anyone to help me?
tnx

Reply With Quote
  #2  
Old   
Dan Guzman
 
Posts: n/a

Default Re: Index design - 11-09-2007 , 06:20 AM






Quote:
But now I ask: If I create an index with all coloumns, it is used by
sqlserver for speed the query who use only 1, or 2 coloumns only?
In order to use an index efficiently (seek instead of scan), the high-order
indexed column must be specified in the WHERE or JOIN. The perfect index
for one query may be useless for another so you may need multiple indexes
and make compromises since too many index can negatively impact
insert/update performance.

There are many factors affecting indexing decisions. You might try running
a representative workload through the Database Engine Tuning Advisor for
suggestions. If you need additional help, post DDL and sample queries.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Enorme Vigenti" <LSimon5 (AT) libero (DOT) it> wrote

Quote:
I have a large table with an unique integer primary key and many coloums
I have various programs to calculate many satistical information, this
programs use many stored procedures.
In other words many select statement query on the same table with where
clause on all combinations for the coloums.
Now I must create index
Initially i was create cluster primary key and many index on datatime
field and one other coloumn
But now I ask: If I create an index with all coloumns, it is used by
sqlserver for speed the query who use only 1, or 2 coloumns only?
...and it is better to make this index clustered (and not the primary
key?)
I'm reading various sqlserver manual to know the index policy but I can't
to understand how to do this!!!
Can anyone to help me?
tnx


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.