SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL table indexing
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sportsguy
Starting Member

USA
38 Posts

Posted - 12/01/2013 :  15:54:39  Show Profile  Reply with Quote
I have created a SS warehouse, so perfect normalization is not a requirement. I have created non unique indexes of 5-7 columns
My question is:
for these 5-7 fields, should I create one index of 5-7 fields,
or 5-7 individual indexes?

thanks in advance. . .
sportsguy

MS Access 20 years, SQL hack

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 12/02/2013 :  04:35:26  Show Profile  Reply with Quote
depends on how you use these columns in the queries. whats the frequency of using them together for filtering.selecting against using them separately?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

TG
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 12/02/2013 :  16:21:58  Show Profile  Reply with Quote
The thing to know for deciding on indexes is when the index will not be used. For instance:

index1234 (col1, col2, col3, col4)

this index will be used when filter and/or joining is done with:
- all four columns
- only these 3: col1, col2, col3
- only these 2: col1, col2
- only this: col1

this index will not be for any other combination of columns.
In other words look at the index columns from left to right.
To use an index for a query that only filters on col3 then you need an index that either is only on col3 or starts with col3


Be One with the Optimizer
TG
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000