Hi everyone, When and what type of data do we need to use clustered and non-clustered index? Thanks, V1rt
What type: Any data type where the data in the column is highly selective (different in each row, or nearly so) and the type is not Text or Image or Binary. When: it helps to speed up the queries you need to run. -------------------------- Yes, I am a geek. I know. I can't help it.
I'm sorry, my question was wrong. What I really mean is, when do we need to create a non-clustered or a clustered index? For example, if I'm looking for a specific string, should I use non-clustered? Thanks!
Each table can have only one clustered index, which determines the order in which the data is actually stored. You should select a column for the clustered index where that ordering is helpful, for example in joins or in selection of ranges (value between X and Y). Any other indexes have to be non-clustered. Does that help? -------------------------- Yes, I am a geek. I know. I can't help it.
It's is hard to give you all possible hints in a few sentences, this is really topic one can write a few articles about. <br />I am sure there are few good articles about that on this site and elswhere. <br />Read them and also follow discussion here, after a month or two you may even become the expert in that area <img src='/community/emoticons/emotion-1.gif' alt='' />
http://www.sql-server-performance.com/q&a71.asp http://www.sql-server-performance.com/q&a59.asp Satya SKJ Moderator http://www.SQL-Server-Performance.Com/forum This posting is provided “AS IS†with no rights for the sake of knowledge sharing.