SQL Server Performance

when and what to use index

Discussion in 'Performance Tuning for DBAs' started by v1rtu0s1ty, Sep 1, 2005.

  1. v1rtu0s1ty New Member

    Hi everyone,

    When and what type of data do we need to use clustered and non-clustered index?

    Thanks,

    V1rt
  2. merrillaldrich New Member

    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.
  3. v1rtu0s1ty New Member

    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!
  4. merrillaldrich New Member

    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.
  5. mmarovic Active Member

    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=':)' />
  6. satya Moderator

  7. v1rtu0s1ty New Member

    Thanks guys! You guys are so helpful!!! <img src='/community/emoticons/emotion-1.gif' alt=':)' />

Share This Page