SlideShare a Scribd company logo
Index is a database object, which can be created on one or more columns (16 Max column
combinations). When creating the index will read the column(s) and forms a relevant data
structure to minimize the number of data comparisons. The index will improve the performance
of data retrieval and adds some overhead on data modification such as create, delete and modify.
So it depends on how much data retrieval can be performed on table versus how much of DML
(Insert, Delete and Update) operations.
In short:-
Index is basically use for fast data retrieval from database.
Example:
For example, if you want to reference all pages in a book that discuss a certain topic, you first
refer to the index, which lists all topics alphabetically and are then referred to one or more
specific page numbers.
Type of Index:
In SQL Server database there are mainly two types of indexes,
1. Clustered index and
2. Non Clustered index
1. Clustered Index
In simple way-
Primary key is Clustered index.
2. Non Clustered Index
Unique key is Non-Clustered index.
Syntax to create Index
The basic syntax of CREATE INDEX is as follows:
CREATE INDEX index_name ON table_name;
The DROP INDEX Command:
An index can be dropped using SQL DROP command. Care should be taken when dropping an
index because performance may be slowed or improved.
The basic syntax is as follows:
DROP INDEX index_name;
Difference between Clustered Index and Non Clustered Index in SQL Server
1.One of the main difference between clustered and non clustered index in SQL Server is that,
one table can only have one clustered Index but It can have many non clustered index,
approximately 250 because Basically primary key is Clustered index and Unique key is Non-
Clustered index and one table have only one primary.
2. Basically primary key is Clustered index and Unique key is Non-Clustered index.
3. A clustered index determines the order in which the rows of the table will be stored on disk .A
non-clustered index has no effect on which the order of the rows will be stored.
4. Non clustered indexes store both a value and a pointer to the actual row that holds that value.
Clustered indexes don’t need to store a pointer to the actual row because of the fact that the rows
in the table are stored on disk in the same exact order as the clustered index.
5. Non-Clustered Index required more space as compared to clustered Index because in non-
clustered index one separate table is maintained.
Here I mostly focus on what is index and types of index in SQL server .Hope u like my articles.
Ad

More Related Content

What's hot (20)

Oracle Database Trigger
Oracle Database TriggerOracle Database Trigger
Oracle Database Trigger
Eryk Budi Pratama
 
Normal forms
Normal formsNormal forms
Normal forms
Samuel Igbanogu
 
Sql server T-sql basics ppt-3
Sql server T-sql basics  ppt-3Sql server T-sql basics  ppt-3
Sql server T-sql basics ppt-3
Vibrant Technologies & Computers
 
Advanced SQL
Advanced SQLAdvanced SQL
Advanced SQL
Sabiha M
 
MySQL: Indexing for Better Performance
MySQL: Indexing for Better PerformanceMySQL: Indexing for Better Performance
MySQL: Indexing for Better Performance
jkeriaki
 
Sql server ___________session_17(indexes)
Sql server  ___________session_17(indexes)Sql server  ___________session_17(indexes)
Sql server ___________session_17(indexes)
Ehtisham Ali
 
SQL
SQLSQL
SQL
Shunya Ram
 
DATABASE CONSTRAINTS
DATABASE CONSTRAINTSDATABASE CONSTRAINTS
DATABASE CONSTRAINTS
sunanditaAnand
 
Sql join
Sql  joinSql  join
Sql join
Vikas Gupta
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
farwa waqar
 
5. stored procedure and functions
5. stored procedure and functions5. stored procedure and functions
5. stored procedure and functions
Amrit Kaur
 
SQL subquery
SQL subquerySQL subquery
SQL subquery
Vikas Gupta
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
webhostingguy
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
Vigneshwaran Sankaran
 
Sub query example with advantage and disadvantages
Sub query example with advantage and disadvantagesSub query example with advantage and disadvantages
Sub query example with advantage and disadvantages
Sarfaraz Ghanta
 
Nested Queries Lecture
Nested Queries LectureNested Queries Lecture
Nested Queries Lecture
Felipe Costa
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
BG Java EE Course
 
Sql operator
Sql operatorSql operator
Sql operator
Pooja Dixit
 
Database index(sql server)
Database index(sql server)Database index(sql server)
Database index(sql server)
Aaron King
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
Megha yadav
 
Advanced SQL
Advanced SQLAdvanced SQL
Advanced SQL
Sabiha M
 
MySQL: Indexing for Better Performance
MySQL: Indexing for Better PerformanceMySQL: Indexing for Better Performance
MySQL: Indexing for Better Performance
jkeriaki
 
Sql server ___________session_17(indexes)
Sql server  ___________session_17(indexes)Sql server  ___________session_17(indexes)
Sql server ___________session_17(indexes)
Ehtisham Ali
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
farwa waqar
 
5. stored procedure and functions
5. stored procedure and functions5. stored procedure and functions
5. stored procedure and functions
Amrit Kaur
 
Sub query example with advantage and disadvantages
Sub query example with advantage and disadvantagesSub query example with advantage and disadvantages
Sub query example with advantage and disadvantages
Sarfaraz Ghanta
 
Nested Queries Lecture
Nested Queries LectureNested Queries Lecture
Nested Queries Lecture
Felipe Costa
 
Database index(sql server)
Database index(sql server)Database index(sql server)
Database index(sql server)
Aaron King
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
Megha yadav
 

Similar to Index in sql server (20)

Sql server lesson6
Sql server lesson6Sql server lesson6
Sql server lesson6
Ala Qunaibi
 
dotnetMALAGA - Sql query tuning guidelines
dotnetMALAGA - Sql query tuning guidelinesdotnetMALAGA - Sql query tuning guidelines
dotnetMALAGA - Sql query tuning guidelines
Javier García Magna
 
Module08
Module08Module08
Module08
guest5c8fba1
 
Module08
Module08Module08
Module08
Sridhar P
 
DBMS and SQL Questions and Answers (1).pdf
DBMS and SQL Questions and Answers (1).pdfDBMS and SQL Questions and Answers (1).pdf
DBMS and SQL Questions and Answers (1).pdf
sifatullah42
 
Sql
SqlSql
Sql
shenazk
 
153680 sqlinterview
153680  sqlinterview153680  sqlinterview
153680 sqlinterview
zdsgsgdf
 
Sql
SqlSql
Sql
sindujaj
 
Sql Interview Questions
Sql Interview QuestionsSql Interview Questions
Sql Interview Questions
arjundwh
 
Sql
SqlSql
Sql
sanjaynuru
 
MSSQL_Book.pdf
MSSQL_Book.pdfMSSQL_Book.pdf
MSSQL_Book.pdf
DubsmashTamizhan
 
SKILLWISE-DB2 DBA
SKILLWISE-DB2 DBASKILLWISE-DB2 DBA
SKILLWISE-DB2 DBA
Skillwise Group
 
Getting to know oracle database objects iot, mviews, clusters and more…
Getting to know oracle database objects iot, mviews, clusters and more…Getting to know oracle database objects iot, mviews, clusters and more…
Getting to know oracle database objects iot, mviews, clusters and more…
Aaron Shilo
 
Dbms interview questions
Dbms interview questionsDbms interview questions
Dbms interview questions
ambika93
 
Database Basics
Database BasicsDatabase Basics
Database Basics
Abdel Moneim Emad
 
Indexing techniques
Indexing techniquesIndexing techniques
Indexing techniques
Huda Alameen
 
Oracle Index
Oracle IndexOracle Index
Oracle Index
Madhavendra Dutt
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
sweetysweety8
 
Sql interview q&a
Sql interview q&aSql interview q&a
Sql interview q&a
Syed Shah
 
SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2
jeetendra mandal
 
Sql server lesson6
Sql server lesson6Sql server lesson6
Sql server lesson6
Ala Qunaibi
 
dotnetMALAGA - Sql query tuning guidelines
dotnetMALAGA - Sql query tuning guidelinesdotnetMALAGA - Sql query tuning guidelines
dotnetMALAGA - Sql query tuning guidelines
Javier García Magna
 
DBMS and SQL Questions and Answers (1).pdf
DBMS and SQL Questions and Answers (1).pdfDBMS and SQL Questions and Answers (1).pdf
DBMS and SQL Questions and Answers (1).pdf
sifatullah42
 
153680 sqlinterview
153680  sqlinterview153680  sqlinterview
153680 sqlinterview
zdsgsgdf
 
Sql Interview Questions
Sql Interview QuestionsSql Interview Questions
Sql Interview Questions
arjundwh
 
Getting to know oracle database objects iot, mviews, clusters and more…
Getting to know oracle database objects iot, mviews, clusters and more…Getting to know oracle database objects iot, mviews, clusters and more…
Getting to know oracle database objects iot, mviews, clusters and more…
Aaron Shilo
 
Dbms interview questions
Dbms interview questionsDbms interview questions
Dbms interview questions
ambika93
 
Indexing techniques
Indexing techniquesIndexing techniques
Indexing techniques
Huda Alameen
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
sweetysweety8
 
Sql interview q&a
Sql interview q&aSql interview q&a
Sql interview q&a
Syed Shah
 
SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2
jeetendra mandal
 
Ad

Recently uploaded (20)

To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Ad

Index in sql server

  • 1. Index is a database object, which can be created on one or more columns (16 Max column combinations). When creating the index will read the column(s) and forms a relevant data structure to minimize the number of data comparisons. The index will improve the performance of data retrieval and adds some overhead on data modification such as create, delete and modify. So it depends on how much data retrieval can be performed on table versus how much of DML (Insert, Delete and Update) operations. In short:- Index is basically use for fast data retrieval from database. Example: For example, if you want to reference all pages in a book that discuss a certain topic, you first refer to the index, which lists all topics alphabetically and are then referred to one or more specific page numbers. Type of Index: In SQL Server database there are mainly two types of indexes, 1. Clustered index and 2. Non Clustered index 1. Clustered Index In simple way- Primary key is Clustered index. 2. Non Clustered Index Unique key is Non-Clustered index.
  • 2. Syntax to create Index The basic syntax of CREATE INDEX is as follows: CREATE INDEX index_name ON table_name; The DROP INDEX Command: An index can be dropped using SQL DROP command. Care should be taken when dropping an index because performance may be slowed or improved. The basic syntax is as follows: DROP INDEX index_name; Difference between Clustered Index and Non Clustered Index in SQL Server 1.One of the main difference between clustered and non clustered index in SQL Server is that, one table can only have one clustered Index but It can have many non clustered index, approximately 250 because Basically primary key is Clustered index and Unique key is Non- Clustered index and one table have only one primary. 2. Basically primary key is Clustered index and Unique key is Non-Clustered index. 3. A clustered index determines the order in which the rows of the table will be stored on disk .A non-clustered index has no effect on which the order of the rows will be stored. 4. Non clustered indexes store both a value and a pointer to the actual row that holds that value. Clustered indexes don’t need to store a pointer to the actual row because of the fact that the rows in the table are stored on disk in the same exact order as the clustered index.
  • 3. 5. Non-Clustered Index required more space as compared to clustered Index because in non- clustered index one separate table is maintained. Here I mostly focus on what is index and types of index in SQL server .Hope u like my articles.