Difference between Cluster and Index

  • Hi, I am really confused about difference between `Cluster` and `Index`.

    I think they are same.

    Please help me to find a correct answer for my mistakes.

    1. What is Cluster?

    I think cluster create indexes on a column, so you can reach row faster.

    2. What is Index?

    I think indexing on a column helps to reach row faster. (So what is difference between this and cluster?)

    3.

    CREATE CLUSTERED INDEX myIndex

    ON tableName (Column1, Column2, Column3)

    What the...? :blink:

    Does it mean if two rows have same value for Column1 then lower value for Index choose by Column2?

    4.

    CREATE NONCLUSTERED INDEX myIndex

    ON tableName (columnName)

    What? :blink:

    Nonclustred index? How is it possible to an Index be nonclustred?

    Im really confused, thank you for help.

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • Rather a complex topic, so here's links to existing articles on indexes and their structure:

    https://www.simple-talk.com/sql/learn-sql-server/sql-server-index-basics/[/url]

    http://www.sqlservercentral.com/stairway/72399/[/url]

    Part 1 and Part 3 give the explanation of the index types...

    I've found the stairway article very helpful, myself.

  • Take a read through these

    http://www.sqlservercentral.com/articles/Indexing/68439/

    http://www.sqlservercentral.com/articles/Indexing/68563/

    http://www.sqlservercentral.com/articles/Indexing/68636/

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Firstly, a "cluster" is a very different animal.

    Having said that, this question is about "clustered indexes" and "non-clustered indexes".

    A clustered index is phisically a part of the target table, rows are ordered by the key, leaf level of the index contains the actual data. That is why you can have only ONE clustered index per table.

    A non-clustered index is a separate object, basically a list of keys and row locators pointing to the target table.

    For more detailed information, please check the links suggested by other posters.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Thank you everyone.

    This article helped me to understand concept of Indexes.

    https://www.simple-talk.com/sql/learn-sql-server/sql-server-index-basics/[/url]

    For a further step I must use them in practice.

    Now I see in this forum there are really professional guys and they kindly help newbie peoples.

    Thank you every one.

    ___________________________________
    Computer Enterprise Masoud Keshavarz
    I don't care about hell.
    If I go there I've played enough Diablo to know how to fight my way out.

  • You might want to consider removing your email address from your signature to prevent spam being directed your way.

    _________________________________________________________________________
    SSC Guide to Posting and Best Practices

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply