Articles → SQL SERVER → Indexes In SQL Server

Indexes In SQL Server








What Do I Need On My System?





What Are The Technical Concepts I Need To Know?




  1. What are tables in SQL server?
  2. What is a primary key?

What Is A Database Index?






  1. An index is a data structure.
  2. Indexes improve the speed of data retrieval operations.
  3. Maintaining indexes incurs additional costs in terms of storage and processing overhead.







Types Of Database Indexes In SQL Server




  1. Clustered index
  2. Non-clustered index

How Physical Sorting And Logical Sorting Are Different







B-Tree




Picture showing the graphical representation of the b-tree









Cluster Index




  1. Only one clustered index per table
  2. Data is stored in leaf node of B-Tree. All other nodes contain index rows
  3. Data is physically sorted


-- Syntax for creating clustered index
CREATE CLUSTERED INDEX index_name ON table_name (column_name)



Non-Clustered Index




  1. More than one non-clustered index can be implemented on a table
  2. Leaf node of B-Tree contains the address of data
  3. Data is logically sorted


-- Syntax for creating non clustered index
CREATE NONCLUSTERED INDEX index_name ON table_name (column_name)





Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, January 28, 2015

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250