May 24, 2012 at 8:33 am
I have two queries I execute on a table.
For Query1, the index would be a combination of Columns - A, B, C, D, E, F, G
For Query2, the index would be a combination of Columns - A, B, C, D, E, H, I
Would like to know the optimised way of creating indexes on the table which hold for both queries. How should it be done?
Thanks
May 24, 2012 at 8:47 am
Not much info in your post here. Pretty hard to offer suggestions about unknowns.
Take a look at the indexes stairway. It is a great series on understanding indexes. I suspect from your question that this series will teach you a lot.
http://www.sqlservercentral.com/stairway/72399/%5B/url%5D
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
May 24, 2012 at 10:03 am
Sean is correct. There is no way to know what might make sense.
As a general rule, you might build indexes with multiple columns. I might, depending on the data, build indexes on A, B, C, D, E, but I wouldn't offer that advice without more information.
Also, please post in the T-SQL or tuning forums. Moved this to those forums.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply