SlideShare a Scribd company logo
Index and Partition
Strategy
By: Hamid J. Fard (Data Platform Specialist)
Session Outlines:
 What an Index is.
 The benefits and overhead of an Index.
 General recommendation for index design.
 Recommendation for Clustered and non-Clustered
Index.
 Index on Partitioned Table
What is an Index?
 An object in SQL Server Database.
 Affects I/O Physical and Logical Operations.
 Affects to Performance of Retrieving Data.
 There are Two Types of Index.
 It might Change the Table Structure.
 Contains Several Levels.
The Benefit of Indexes
 Clustered Index Improves Modification Performance
 Clustered Index Changes the Table Structure
 Clustered Index Sort the Data Physically
 Non-Clustered Index Improves Query Performance
 Non-Clustered Index Points at RID or Clustered Index
 Non-Clustered Index can be Stored on Different I/O
Path to Improve the I/O Performance
The Benefit of Indexes (Cont.)
 Consider single column table with 27 rows.
Initial Layout of 27 Rows
Ordered Layout of 27 Rows
B-Tree Layout of 27 Rows
Index Overhead
 Table with Index needs more Storage and Memory
 Data Manipulation Queries (CRUD) Take Longer
 More Processing Time Required to Maintain the
Indexes of Constantly Changing Tables
 Clustered Index has Greater Overhead
 SQL Server supplies some DMVs for Monitoring Index
Performance and Detail Information
sys.dm_db_index_operational_stats (Low-Level Information)
sys.dm_db_index_usage_stats (Returns Statistics)
Index Design Recommendation
 Examine the Where and Join criteria clause
 Use Narrow Indexes
 Examine Column Uniqueness
 Examine the Column Data Type
 Consider Column Order
 Consider the Type of Index (Clustered vs. NonClustered)
Use Narrow Index
 Avoid Wide Data Type such as
CHAR, VARCHAR, NCHAR, NVARCHAR
It can Accumulate more Rows in 8KB Index Page.
Reduces Storage space for Database
Reduces the I/O Operations.
Clustered Index Recommendations
 Create Clustered Index First.
 Keep the Index Key Narrow.
 Rebuild the Clustered Index in Single Step.
 Create Clustered Index with Preorder Sort.
 Do not Create Clustered Index on Frequently
Updatable Column.
 Do not Use Wide Key.
 Prevent Too Many Concurrent Inserts in Sequential
Order.
Non-Clustered Index Recommendation
 Can be Used with Wide Key.
 It Can be on Frequently Updatable Columns.
 Can be Filtered.
 Can be Used in Join or Where Criteria Clause.
 Can be on Low Selectivity Column.
Covering Indexes
 It can Improve the Query Performance.
 It Stores the Covering Columns Next to the RID.
 It does not Required to Read the Base Table.
 Reduces I/O Operations.
 Reduces Execution Time.
Index Compression
 Introduced in SQL Server 2008.
 Available only in Enterprise and Developer Edition.
 This can lead to Serious Performance Improvement.
 There will be an Overhead of CPU and Memory.
 Non-Leaf Pages in an Index Receive no Compression
under the Page Type.
Index on Partitioned Table
 Different index will be created on every partition.
 Each index can be rebuilt or reorganized separately.
 It boost up the CRUD operations performance.
 SQL Server can manage every index separately on
every partition.
Demo
 Create Partition Table
 Retrieve Specific Partition’s Record.
 Create Index on every Partition.
 Rebuild the Index on Specific Partition.
Questions and Answers
?
(15 Minutes)

More Related Content

ODP
Database index by Reema Gajjar
PPTX
Sql server ___________session_17(indexes)
PDF
Database Indexes
PPT
File organization
PPT
SQL subquery
PPTX
Sql Constraints
PPTX
PDF
MySQL: Indexing for Better Performance
Database index by Reema Gajjar
Sql server ___________session_17(indexes)
Database Indexes
File organization
SQL subquery
Sql Constraints
MySQL: Indexing for Better Performance

What's hot (20)

PPTX
Introduction to RDBMS
PPTX
Session 14 - Hive
PPTX
Basic sql Commands
PDF
Presentation On NoSQL Databases
DOCX
Index in sql server
PDF
View & index in SQL
PPTX
Data partitioning
PPTX
Non relational databases-no sql
PPTX
Joins And Its Types
PPTX
Sql joins inner join self join outer joins
ODP
PDF
PL/SQL TRIGGERS
PPSX
Sql triggers
PPT
Introduction to sql
PDF
SQL Queries - DDL Commands
PPTX
Dbms database models
PPT
Aggregate functions
PPTX
Types of keys dbms
ODP
Introduction to triggers
PPT
Advanced sql
Introduction to RDBMS
Session 14 - Hive
Basic sql Commands
Presentation On NoSQL Databases
Index in sql server
View & index in SQL
Data partitioning
Non relational databases-no sql
Joins And Its Types
Sql joins inner join self join outer joins
PL/SQL TRIGGERS
Sql triggers
Introduction to sql
SQL Queries - DDL Commands
Dbms database models
Aggregate functions
Types of keys dbms
Introduction to triggers
Advanced sql
Ad

Viewers also liked (6)

PDF
Biml for Beginners - Generating SSIS Packages with BimlScript (SQLSaturday Go...
PDF
Level Up Your Biml: Best Practices and Coding Techniques (NTK 2016)
PDF
Level Up Your Biml: Best Practices and Coding Techniques (SQLSaturday Minnesota)
PDF
Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL ...
PDF
Level Up Your Biml: Best Practices and Coding Techniques (SQLSaturday Sacrame...
PDF
Table Partitioning in SQL Server: A Magic Solution for Better Performance? (P...
Biml for Beginners - Generating SSIS Packages with BimlScript (SQLSaturday Go...
Level Up Your Biml: Best Practices and Coding Techniques (NTK 2016)
Level Up Your Biml: Best Practices and Coding Techniques (SQLSaturday Minnesota)
Don't Repeat Yourself - Agile SSIS Development with Biml and BimlScript (SQL ...
Level Up Your Biml: Best Practices and Coding Techniques (SQLSaturday Sacrame...
Table Partitioning in SQL Server: A Magic Solution for Better Performance? (P...
Ad

Similar to SQL Server Index and Partition Strategy (20)

PDF
SQLDay2013_Denny Cherry - Table indexing for the .NET Developer
PPTX
Introduction of sql server indexing
PPTX
JSSUG: SQL Sever Index Tuning
PPTX
Sql server lesson6
PPTX
dotnetMALAGA - Sql query tuning guidelines
DOCX
Indexes in ms sql server
PPTX
Indy pass writing efficient queries – part 1 - indexing
PPT
Module08
PPT
Module08
PPTX
We Don't Need Roads: A Developers Look Into SQL Server Indexes
PPTX
Sql performance tuning
PDF
SQA server performance tuning
PPTX
Database Performance
PPTX
SAG_Indexing and Query Optimization
PPTX
Query Optimization in SQL Server
PDF
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
PPTX
Geek Sync | SQL Server Indexing Basics
PPT
SQL Server 2000 Research Series - Performance Tuning
PPT
Indexing Strategies
PPT
Filtered Indexes In Sql 2008
SQLDay2013_Denny Cherry - Table indexing for the .NET Developer
Introduction of sql server indexing
JSSUG: SQL Sever Index Tuning
Sql server lesson6
dotnetMALAGA - Sql query tuning guidelines
Indexes in ms sql server
Indy pass writing efficient queries – part 1 - indexing
Module08
Module08
We Don't Need Roads: A Developers Look Into SQL Server Indexes
Sql performance tuning
SQA server performance tuning
Database Performance
SAG_Indexing and Query Optimization
Query Optimization in SQL Server
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
Geek Sync | SQL Server Indexing Basics
SQL Server 2000 Research Series - Performance Tuning
Indexing Strategies
Filtered Indexes In Sql 2008

More from Hamid J. Fard (12)

PPTX
Sql server backup internals
PDF
SQL Server High Availability Solutions (Pros & Cons)
PPTX
SQL Server Memory Pressure
PPTX
SQL Server In-Memory Internals and Performance Tips
PPTX
Fard Solutions Sdn Bhd
PPTX
Sql server enterprise edition awareness
PDF
Data Platform Overview
PDF
SQL Server 2016 Everything built-in FULL deck
PPTX
SQL Server - Inside Optimizer Engine
PPTX
SQL Server Database Backup and Restore Plan
PPTX
SQL Server Security And Encryption
PPTX
SQL Saturday #438
Sql server backup internals
SQL Server High Availability Solutions (Pros & Cons)
SQL Server Memory Pressure
SQL Server In-Memory Internals and Performance Tips
Fard Solutions Sdn Bhd
Sql server enterprise edition awareness
Data Platform Overview
SQL Server 2016 Everything built-in FULL deck
SQL Server - Inside Optimizer Engine
SQL Server Database Backup and Restore Plan
SQL Server Security And Encryption
SQL Saturday #438

Recently uploaded (20)

PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
PPTX
05. PRACTICAL GUIDE TO MICROSOFT EXCEL.pptx
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PDF
Mega Projects Data Mega Projects Data
PPT
Miokarditis (Inflamasi pada Otot Jantung)
PPTX
Moving the Public Sector (Government) to a Digital Adoption
PPTX
Supervised vs unsupervised machine learning algorithms
PPT
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
PDF
Launch Your Data Science Career in Kochi – 2025
PPT
Quality review (1)_presentation of this 21
PPTX
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PDF
.pdf is not working space design for the following data for the following dat...
PPTX
Database Infoormation System (DBIS).pptx
PPTX
Business Acumen Training GuidePresentation.pptx
PPTX
CEE 2 REPORT G7.pptxbdbshjdgsgjgsjfiuhsd
Acceptance and paychological effects of mandatory extra coach I classes.pptx
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
05. PRACTICAL GUIDE TO MICROSOFT EXCEL.pptx
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
Mega Projects Data Mega Projects Data
Miokarditis (Inflamasi pada Otot Jantung)
Moving the Public Sector (Government) to a Digital Adoption
Supervised vs unsupervised machine learning algorithms
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
Launch Your Data Science Career in Kochi – 2025
Quality review (1)_presentation of this 21
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
.pdf is not working space design for the following data for the following dat...
Database Infoormation System (DBIS).pptx
Business Acumen Training GuidePresentation.pptx
CEE 2 REPORT G7.pptxbdbshjdgsgjgsjfiuhsd

SQL Server Index and Partition Strategy

  • 1. Index and Partition Strategy By: Hamid J. Fard (Data Platform Specialist)
  • 2. Session Outlines:  What an Index is.  The benefits and overhead of an Index.  General recommendation for index design.  Recommendation for Clustered and non-Clustered Index.  Index on Partitioned Table
  • 3. What is an Index?  An object in SQL Server Database.  Affects I/O Physical and Logical Operations.  Affects to Performance of Retrieving Data.  There are Two Types of Index.  It might Change the Table Structure.  Contains Several Levels.
  • 4. The Benefit of Indexes  Clustered Index Improves Modification Performance  Clustered Index Changes the Table Structure  Clustered Index Sort the Data Physically  Non-Clustered Index Improves Query Performance  Non-Clustered Index Points at RID or Clustered Index  Non-Clustered Index can be Stored on Different I/O Path to Improve the I/O Performance
  • 5. The Benefit of Indexes (Cont.)  Consider single column table with 27 rows. Initial Layout of 27 Rows Ordered Layout of 27 Rows B-Tree Layout of 27 Rows
  • 6. Index Overhead  Table with Index needs more Storage and Memory  Data Manipulation Queries (CRUD) Take Longer  More Processing Time Required to Maintain the Indexes of Constantly Changing Tables  Clustered Index has Greater Overhead  SQL Server supplies some DMVs for Monitoring Index Performance and Detail Information sys.dm_db_index_operational_stats (Low-Level Information) sys.dm_db_index_usage_stats (Returns Statistics)
  • 7. Index Design Recommendation  Examine the Where and Join criteria clause  Use Narrow Indexes  Examine Column Uniqueness  Examine the Column Data Type  Consider Column Order  Consider the Type of Index (Clustered vs. NonClustered)
  • 8. Use Narrow Index  Avoid Wide Data Type such as CHAR, VARCHAR, NCHAR, NVARCHAR It can Accumulate more Rows in 8KB Index Page. Reduces Storage space for Database Reduces the I/O Operations.
  • 9. Clustered Index Recommendations  Create Clustered Index First.  Keep the Index Key Narrow.  Rebuild the Clustered Index in Single Step.  Create Clustered Index with Preorder Sort.  Do not Create Clustered Index on Frequently Updatable Column.  Do not Use Wide Key.  Prevent Too Many Concurrent Inserts in Sequential Order.
  • 10. Non-Clustered Index Recommendation  Can be Used with Wide Key.  It Can be on Frequently Updatable Columns.  Can be Filtered.  Can be Used in Join or Where Criteria Clause.  Can be on Low Selectivity Column.
  • 11. Covering Indexes  It can Improve the Query Performance.  It Stores the Covering Columns Next to the RID.  It does not Required to Read the Base Table.  Reduces I/O Operations.  Reduces Execution Time.
  • 12. Index Compression  Introduced in SQL Server 2008.  Available only in Enterprise and Developer Edition.  This can lead to Serious Performance Improvement.  There will be an Overhead of CPU and Memory.  Non-Leaf Pages in an Index Receive no Compression under the Page Type.
  • 13. Index on Partitioned Table  Different index will be created on every partition.  Each index can be rebuilt or reorganized separately.  It boost up the CRUD operations performance.  SQL Server can manage every index separately on every partition.
  • 14. Demo  Create Partition Table  Retrieve Specific Partition’s Record.  Create Index on every Partition.  Rebuild the Index on Specific Partition.