SlideShare une entreprise Scribd logo
1  sur  16
8.1 : Indexes SQL Server 2005
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Contents
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What is Index ,[object Object],[object Object],[object Object]
Need of Indexes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Types of indexes ,[object Object],[object Object],[object Object],[object Object]
Types of Index (Continued) ,[object Object],[object Object],[object Object],[object Object],[object Object]
To Work with Index ,[object Object],[object Object],[object Object],CREATE [UNIQUE] [CLUSTERED/NONCLUSTERED]INDEX index_name ON table_name (column_name [, column_name]…)
To Drop Index ,[object Object],[object Object],[object Object],DROP INDEX 'table.index | view.index' [ ,...n ]
Example 1 - Index ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example 2  Index ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Key Points ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Key Points  (Continued) ,[object Object],[object Object],[object Object]
Activity Time (30 minutes) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Activity Time (30 minutes) continued ,[object Object],[object Object],[object Object]
Questions & Comments

Contenu connexe

Tendances

4) databases
4) databases4) databases
4) databases
techbed
 
Data Handning with Sqlite for Android
Data Handning with Sqlite for AndroidData Handning with Sqlite for Android
Data Handning with Sqlite for Android
Jakir Hossain
 

Tendances (18)

Oracle SQL Part 2
Oracle SQL Part 2Oracle SQL Part 2
Oracle SQL Part 2
 
Oracle SQL Part 3
Oracle SQL Part 3Oracle SQL Part 3
Oracle SQL Part 3
 
4) databases
4) databases4) databases
4) databases
 
Technical stream presentation
Technical stream presentationTechnical stream presentation
Technical stream presentation
 
Oracle SQL - Select Part -1 let's write some queries!
Oracle SQL - Select Part -1  let's write some queries!Oracle SQL - Select Part -1  let's write some queries!
Oracle SQL - Select Part -1 let's write some queries!
 
SQLite Database Tutorial In Android
SQLite Database Tutorial In AndroidSQLite Database Tutorial In Android
SQLite Database Tutorial In Android
 
Excel 2007 Unit F
Excel 2007 Unit FExcel 2007 Unit F
Excel 2007 Unit F
 
Oracle SQL - Grants, filters, groups and more
Oracle SQL - Grants, filters, groups and moreOracle SQL - Grants, filters, groups and more
Oracle SQL - Grants, filters, groups and more
 
Data Handning with Sqlite for Android
Data Handning with Sqlite for AndroidData Handning with Sqlite for Android
Data Handning with Sqlite for Android
 
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
 
Access tips access and sql part 1 setting the sql scene
Access tips  access and sql part 1  setting the sql sceneAccess tips  access and sql part 1  setting the sql scene
Access tips access and sql part 1 setting the sql scene
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
Views
ViewsViews
Views
 
Excel 2007 Unit N
Excel 2007 Unit NExcel 2007 Unit N
Excel 2007 Unit N
 
MySQL index optimization techniques
MySQL index optimization techniquesMySQL index optimization techniques
MySQL index optimization techniques
 
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
 
IBM SPSS Statistics Interface - Navigation
IBM SPSS Statistics Interface - NavigationIBM SPSS Statistics Interface - Navigation
IBM SPSS Statistics Interface - Navigation
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developer
 

En vedette (12)

Texturappt
TexturapptTexturappt
Texturappt
 
A Descoberta dos habitats
A Descoberta dos habitatsA Descoberta dos habitats
A Descoberta dos habitats
 
Java8
Java8Java8
Java8
 
S4 tarea4 garom
S4 tarea4 garomS4 tarea4 garom
S4 tarea4 garom
 
Whitepaper
WhitepaperWhitepaper
Whitepaper
 
Уникальный "коренной" метод от Lifelong Income
Уникальный "коренной" метод от Lifelong IncomeУникальный "коренной" метод от Lifelong Income
Уникальный "коренной" метод от Lifelong Income
 
Root
RootRoot
Root
 
Final presentation for teachers in action marissa holiber
Final presentation for teachers in action marissa holiberFinal presentation for teachers in action marissa holiber
Final presentation for teachers in action marissa holiber
 
Rld v3
Rld v3Rld v3
Rld v3
 
Texturas-ppt
Texturas-pptTexturas-ppt
Texturas-ppt
 
Testes Unitários
Testes UnitáriosTestes Unitários
Testes Unitários
 
S5 tarea5 garom
S5 tarea5 garomS5 tarea5 garom
S5 tarea5 garom
 

Similaire à Module08

SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdf
DraguClaudiu
 
02 database oprimization - improving sql performance - ent-db
02  database oprimization - improving sql performance - ent-db02  database oprimization - improving sql performance - ent-db
02 database oprimization - improving sql performance - ent-db
uncleRhyme
 
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
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
PavithSingh
 
Sydney Oracle Meetup - indexes
Sydney Oracle Meetup - indexesSydney Oracle Meetup - indexes
Sydney Oracle Meetup - indexes
paulguerin
 
Sql Interview Questions
Sql Interview QuestionsSql Interview Questions
Sql Interview Questions
arjundwh
 

Similaire à Module08 (20)

Sql server lesson6
Sql server lesson6Sql server lesson6
Sql server lesson6
 
dotnetMALAGA - Sql query tuning guidelines
dotnetMALAGA - Sql query tuning guidelinesdotnetMALAGA - Sql query tuning guidelines
dotnetMALAGA - Sql query tuning guidelines
 
Query parameterization
Query parameterizationQuery parameterization
Query parameterization
 
Filtered Indexes In Sql 2008
Filtered Indexes In Sql 2008Filtered Indexes In Sql 2008
Filtered Indexes In Sql 2008
 
SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdf
 
02 database oprimization - improving sql performance - ent-db
02  database oprimization - improving sql performance - ent-db02  database oprimization - improving sql performance - ent-db
02 database oprimization - improving sql performance - ent-db
 
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…
 
Optimizing Data Accessin Sq Lserver2005
Optimizing Data Accessin Sq Lserver2005Optimizing Data Accessin Sq Lserver2005
Optimizing Data Accessin Sq Lserver2005
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
 
Taming the Data Science Monster with A New ‘Sword’ – U-SQL
Taming the Data Science Monster with A New ‘Sword’ – U-SQLTaming the Data Science Monster with A New ‘Sword’ – U-SQL
Taming the Data Science Monster with A New ‘Sword’ – U-SQL
 
Sydney Oracle Meetup - indexes
Sydney Oracle Meetup - indexesSydney Oracle Meetup - indexes
Sydney Oracle Meetup - indexes
 
Sql
SqlSql
Sql
 
Sql Interview Questions
Sql Interview QuestionsSql Interview Questions
Sql Interview Questions
 
Sql
SqlSql
Sql
 
Sql
SqlSql
Sql
 
153680 sqlinterview
153680  sqlinterview153680  sqlinterview
153680 sqlinterview
 
Physical Design and Development
Physical Design and DevelopmentPhysical Design and Development
Physical Design and Development
 
Module02
Module02Module02
Module02
 
Database index
Database indexDatabase index
Database index
 
Database testing
Database testingDatabase testing
Database testing
 

Dernier

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Dernier (20)

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

Module08

Notes de l'éditeur

  1. Faculty Notes : For example : Indexes in SQL server are like an index that are given at back of any book which helps in finding topics you are looking for.
  2. Faculty Notes: Maintaining indexes requires time and resources. User should not create an index that would not be used frequently. The clustered index should be created before non clustered index. Clustered index changes the order of rows. The non clustered index would need to be rebuilt if it is built before clustered index. Typically, non clustered indexes are created on foreign keys
  3. Faculty Notes: How clustered indexes work SQL server 2005 performs the following steps when it uses a clustered index to search for a value: 1. SQL server 2005 obtains the address of the root page from sysindexes table. 2. The search values are compared with the keys of the root page 3. The highest key value is found on the page where the key value is less than or equal to the search value 4. The page pointer is followed to the next lowest level in the index 5. Steps 3 and 4 are repeated until the data page is reached 6. The rows of data are searched on the data page until the search value is found. If search value is not found on the data page ,no rows are returned by the query.
  4. Faculty notes: SQL server creates non clustered index by default .The data is present in random order but the logical ordering is specified by the index. The data rows may be randomly spread throught the table The non clustered index tree contains the index keys in the sorted order, with the leaf level of the index containing the pointer to the data page and the row no in the data page. SQL server 2005 performs the following steps when it uses a non clustered index to search for value: 1.SQL server obtains the address of the root page from the sysindexes table. 2. The search values are compared with the keys of the root page 3. The Page with the highest key value less than or equal to the search value is found 4. The page pointer is followed to the next lowest level in the index 5. Steps 3 and 4 are repeated until the data page is reached 6.The rows are searched on the leaf page for the specified value .If a match is not found; the table contains no matching rows. 7.If a match is found, the pointer is followed to the data page and row-id in the table, and the requested row is retrieved Non Clustered Index : The data is stored in one place, the index in another, with pointers to the storage location of the data. The items in the index are stored in the order of the index key values, but the information in the table is stored in a different order (which can be dictated by a clustered index). If no clustered index is created on the table, the rows are not guaranteed to be in any particular order.
  5. Faculty notes: UNIQUE creates an index in which each row should contain a different index value. CLUSTERED specifies a clustered index in which the data is sorted on the index attribute. NON CLUSTERED specifies a non clustered index that specifies only the logical Ordering of data, physically data is not sorted. Index_name specifies name of the index .it should be unique for a table, but may not be unique within a database. Table_name specifies name of the table that contains the attributes on which the index is to be created. Columns specifies name of the columns on which the index would be created.
  6. Faculty Notes Examples This example removes the index named au_id_ind in the authors table. USE pubs IF EXISTS (SELECT name FROM sysindexes WHERE name = 'au_id_ind') DROP INDEX authors.au_id_ind GO
  7. Faculty Notes : This Examples shows that user can create the index using create command Create index pk1_index on employees (EmployeeID) pk1_index is the Index name Employees is the table name present in Northwind database To view the index whether index is created or not use the following statements sp_help employees. Sp_helpindex employees To drop the index use the following command drop index employees.pk1_index