Index design

Index design

am 09.11.2007 09:52:37 von Enorme Vigenti

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

Re: Index design

am 09.11.2007 13:20:33 von Dan Guzman

> 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" wrote in message
news:pdVYi.167681$U01.1180410@twister1.libero.it...
>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