SQL Indexes

  • Clustered Indexes:
    • Use B-Tree algorithm.
    • Only one index for a table.
    • Clustered indexes are similar to a telephone directory where you search a person's name alphabetically and get his phone number there only.
    • CLUSTERED INDEX SCAN:
      • When table with crusted index is accessed
      • The query doesn't use the non-clustered index in the table.
      • The table does not have any non-clustered index.
      • It will be bad when large data with most columns and rows are retrieved
    • CLUSTERED INDEX SEEK:
      • When
        • Table with clustered index is accessed and query locates specific rows in B+ tree.
        • It will be always good.
      • Even though evaluate the possibility of non-clustered index.
  • Non Clustered Indexes:
    • Use B-Tree algorithm.
    • For SQL 2005 249 Non Clustered Index. It is 999 for SQL 2008.
    • Non Clustered indexes are similar to the Index of a book where you get the page number of the item you were searching for. Then turn to that page and read what you were looking for.
  • NON - CLUSTERED INDEX SCAN:
    • When
      • Columns part of non-clustered index is accessed in query.
    • It will be bad when large data with most columns and rows are retrieved.
    • When it occur, need to create more defined non-clustered index.
  • NON - CLUSTERED INDEX SEEK:
    • When
      • Columns part of non-clustered index is accessed in query and rows located in B+ tree.
    • It will be always good.

Comments

Popular posts from this blog

BDD - Acceptance Test Driven Development

Angular JS – Part 2

.Net Collections