SlideShare a Scribd company logo
1 of 31
Download to read offline
Table Indexing for the .NET Developer
Denny Cherry
mrdenny@dcac.co
twitter.com/mrdenny
About Me
•
•
•
•
•
•
•
•

Denny Cherry & Associates Consulting
Author or Coauthor of 7 books
8+ SQL Mag articles
Dozens of other articles
Microsoft MVP
Microsoft Certified Master
VMware vExpert
Microsoft Certified Trainer
2
Today’s Goals
•
•
•
•
•

Introduce the different kinds of indexes
Common Misconceptions about indexes
Downsides to indexes
Introduce advanced index tuning techniques
Q&A
Today’s Goals
•
•
•
•
•

Introduce the different kinds of indexes
Common Misconceptions about indexes
Downsides to indexes
Introduce advanced index tuning techniques
Q&A
Different Kinds of Indexes
• Five Kinds of Indexes
–
–
–
–
–

Clustered
Non-clustered
Full Text
XML
ColumnStore Indexes

• There’s new stuff coming in SQL Server 2012
– Semantic Search
Clustered Indexes
• 1 Clustered Index per table
• Contain Full Copy of row data within in the index
• Up to 16 indexed columns can be part of the index
– (15 if the table contains any XML indexes)

•
•
•
•

Primary Key will by default be the Clustered Index
Must be created on the same filegroup as the table
Clustered Indexes should be as narrow as possible
While not required, they are highly recommended
Non-clustered Index
• Up to 999 per table Starting with SQL Server 2008
– 255 in SQL Server 2005 and below

• Up to 16 indexed columns in the index
• Non-indexed columns can be included via INCLUDE
statement
• Non-Clustered indexes always contain the clustered index
columns (when table has a clustered index)
• When table is a heap, the Row ID is stored in every nonclustered index.
• Can be created on any filegroup within the database
• Can be filtered indexes to include fewer rows in the
index.
Differences between unique and nonunique clustered indexes
• Non-Unique clustered indexes have an extra column
called the uniqueifier which ensures that values
within the index are unique.
• Uniqueifier is only used for rows which are not
unique.
EmpId

Uniqufier

1
2
3
4

0

4

1

5
6
7

0

7

1

8
Full Text Indexes
• Not accessed via normal SELECT statements
• Require use of a predicate:
–
–
–
–

CONTAINS
CONTAINSTABLE
FREETEXT
FREETEXTTABLE

• Can be used to search binary values (doc, docx, xls, pdf)
stored within the database.
• Natural Language Search
• Can index XML documents, but only indexes the values,
not the tags.
Full Text Indexes (SQL 2005 and
below)
• Created and managed outside of the database via
Microsoft Search Service
• Backed up with the database (starting in SQL 2005)
• Searches entire index and returns all matches, which
you then filter against your normal table to return
correct set of rows.
Full Text Indexes (SQL 2008 and up)
• Now stored within the database
• Command is still parsed via MS Search service, but
looking is done natively
• Full text search now only searches the required
subset of rows
• When creating your indexes use an identity field as
the key to improve query performance.
XML Indexes
• Allows you to index specific nodes of the XML
document
• 249 XML Indexes pre table
• Requires a Clustered Index on the table
• Each xml column can have a single primary XML
index and multiple secondary XML indexes
• XML Indexes can only be created on a single XML
Column
• No online rebuilds
• Not available for XML variables. Only used on tables.
Primary XML Index
• When created creates a hidden node table
– Contains base table primary key and 12 columns of
info about every node within the XML value

• Effectively the clustered index on the node table
– Base Table Clustered Index Value
– Node id from the node table

• Increases storage 200-500%
Secondary XML Indexes
• Non-Clustered Indexes on the hidden node table
• Three kinds of secondary indexes
– PATH index on the node id (path) and the value
– VALUE index is on the value and the node id (path)
– PROPERTY index is on the base table’s clustered index,
node id (path) and the value
Today’s Goals
•
•
•
•
•

Introduce the different kinds of indexes
Common Misconceptions about indexes
Downsides to indexes
Introduce advanced index tuning techniques
Q&A
Common Misconceptions about
indexes
• Indexes don’t require maintenance
• If I create one index for each column in my where
clause I’ll be fine
• The table is sorted based on the order of the
Clustered Index
• Clustered Indexes are required
Today’s Goals
•
•
•
•
•

Introduce the different kinds of indexes
Common Misconceptions about indexes
Downsides to indexes
Introduce advanced index tuning techniques
Q&A
Downsides to indexes
• Indexes take up space
– On large complex databases the indexes can take up
more space than the table
– Data is duplicated in each index which contains the
column

• Indexes slow down insert, update, delete (especially
full text indexes) statements
• Using the wrong index can be slower than using no
index
• Encrypted data can’t be effectively indexed
Today’s Goals
•
•
•
•
•

Introduce the different kinds of indexes
Common Misconceptions about indexes
Downsides to indexes
Introduce advanced index tuning techniques
Q&A
Advanced Index Tuning Techniques
• Fillfactor
– Tells the SQL Server how much free space to leave in
the leaf level pages.

• Padding
– Tells the SQL Server to use the Fillfactor setting to
leave free space in the intermediate-level pages.

• Online Rebuilds
• Data Compression
What is a ColumnStore Index?
• Totally new and different approach to indexing
• Data is stored via columns not rows
• Each column is stored separately, then compressed using
VertiPak compression engine
• SQL Server’s first B-Tree less index
How does ColumnStore do that?

C1

C2

C3

C4

C5

C6
ColumnStore: Use Case
• Data continues to grow, but performance
requirements stay the same
• Many data warehouses approach PB ranges
• Data needs to be filtered, aggregated, and grouped
despite the size of the dataset
Limitations
• Unsupported Data Types include
– Uniqueidentifier
– Blob
– Numeric (19,2) or higher

• Read Only
• OUTER JOINs using ColumnStore don’t perform well
Using the Advanced Index Tuning
Techniques
CREATE INDEX MyIndex ON dbo.MyTable
ON (Col1, Col5, Col3)
INCLUDE (Col4, Col2)
WHERE Col6 = ‘Value3’
WITH (FILLFACTOR=70, PAD_INDEX=ON, ONLINE=ON,
DATA_COMPRESSION = ROW | PAGE);
Physical Index B-Tree Layout
Clustered (BOL 2005 / 2008)

Non-Clustered (BOL 2005 / 2008)
How large are my indexes?
• SELECT *
• FROM sys.dm_db_index_physical_stats (db_id(),
object_id(‘table_name’), null, null, ‘detailed’)
–
–
–
–
–

Database Id
Object Id
Index Id
Partition Number
Mode (NULL | Limited, Sampled, Detailed)
What Indexes are being used?
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•

DECLARE @dbid INT
, @dbName VARCHAR(100);
SELECT @dbid = DB_ID()
, @dbName = DB_NAME();
WITH partitionCTE (OBJECT_ID, index_id, row_count, partition_count)
AS
(
SELECT [OBJECT_ID]
, index_id
, SUM([ROWS]) AS 'row_count'
, COUNT(partition_id) AS 'partition_count'
FROM sys.partitions
GROUP BY [OBJECT_ID]
, index_id
)
SELECT OBJECT_NAME(i.[OBJECT_ID]) AS objectName
, i.name
, CASE
WHEN i.is_unique = 1
THEN 'UNIQUE '
ELSE ''
END + i.type_desc AS 'indexType'
, ddius.user_seeks
, ddius.user_scans
, ddius.user_lookups
, ddius.user_updates
, cte.row_count
, CASE WHEN partition_count > 1 THEN 'yes'
ELSE 'no' END AS 'partitioned?'
, CASE
WHEN i.type = 2 And i.is_unique = 0
THEN 'Drop Index ' + i.name
+ ' On ' + @dbName
+ '.dbo.' + OBJECT_NAME(ddius.[OBJECT_ID]) + ';'
WHEN i.type = 2 And i.is_unique = 1
THEN 'Alter Table ' + @dbName
+ '.dbo.' + OBJECT_NAME(ddius.[OBJECT_ID])
+ ' Drop Constraint ' + i.name + ';'
ELSE ''
END AS 'SQL_DropStatement'
FROM sys.indexes AS i
INNER Join sys.dm_db_index_usage_stats ddius
ON i.OBJECT_ID = ddius.OBJECT_ID
And i.index_id = ddius.index_id
INNER Join partitionCTE AS cte
ON i.OBJECT_ID = cte.OBJECT_ID
And i.index_id = cte.index_id
WHERE ddius.database_id = @dbid
ORDER BY 1,
(ddius.user_seeks + ddius.user_scans + ddius.user_lookups) ASC
, user_updates DESC;
More Reading…
• http://dcac.co/res/table-indexing-net
Q&A
Denny Cherry
mrdenny@dcac.co
http://www.dcac.co
http://www.twitter.com/mrdenny

Please rate my presentation at http://speakerrate.com/mrdenny

More Related Content

What's hot

What is NoSQL and CAP Theorem
What is NoSQL and CAP TheoremWhat is NoSQL and CAP Theorem
What is NoSQL and CAP TheoremRahul Jain
 
Performance Eye for the SQL Guy
Performance Eye for the SQL GuyPerformance Eye for the SQL Guy
Performance Eye for the SQL GuyWarwick Rudd
 
Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...
Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...
Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...MediaMongrels Ltd
 
MongoDB - An Agile NoSQL Database
MongoDB - An Agile NoSQL DatabaseMongoDB - An Agile NoSQL Database
MongoDB - An Agile NoSQL DatabaseGaurav Awasthi
 
DMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDavid Mann
 
Azure sql database limitations
Azure sql database limitationsAzure sql database limitations
Azure sql database limitationsBRIJESH KUMAR
 
Windows Azure platform
Windows Azure platformWindows Azure platform
Windows Azure platformGetDev.NET
 
REDIS (Remote Dictionary Server)
REDIS (Remote Dictionary Server)REDIS (Remote Dictionary Server)
REDIS (Remote Dictionary Server)Ameya Vijay Gokhale
 
Daten und Verzeichnisse Vergleichen/Synchronisieren mit Beyond Compare (Windo...
Daten und Verzeichnisse Vergleichen/Synchronisieren mit Beyond Compare (Windo...Daten und Verzeichnisse Vergleichen/Synchronisieren mit Beyond Compare (Windo...
Daten und Verzeichnisse Vergleichen/Synchronisieren mit Beyond Compare (Windo...frankstaude
 
Doxxy: Document and Report generation for Oracle made easy
Doxxy: Document and Report generation for Oracle made easyDoxxy: Document and Report generation for Oracle made easy
Doxxy: Document and Report generation for Oracle made easyJan Huyzentruyt
 
Exploring azure cloud storage
Exploring azure cloud storageExploring azure cloud storage
Exploring azure cloud storageSpiffy
 
SQL vs NoSQL: Big Data Adoption & Success in the Enterprise
SQL vs NoSQL: Big Data Adoption & Success in the EnterpriseSQL vs NoSQL: Big Data Adoption & Success in the Enterprise
SQL vs NoSQL: Big Data Adoption & Success in the EnterpriseAnita Luthra
 
Latest Advance Animated Ado.Net With JDBC
Latest Advance Animated Ado.Net With JDBC Latest Advance Animated Ado.Net With JDBC
Latest Advance Animated Ado.Net With JDBC Tarun Jain
 
Simple Yet Powerful Software and System Requirements Management
Simple Yet Powerful Software and System Requirements ManagementSimple Yet Powerful Software and System Requirements Management
Simple Yet Powerful Software and System Requirements ManagementEccam
 

What's hot (20)

What is NoSQL and CAP Theorem
What is NoSQL and CAP TheoremWhat is NoSQL and CAP Theorem
What is NoSQL and CAP Theorem
 
05 entity framework
05 entity framework05 entity framework
05 entity framework
 
Performance Eye for the SQL Guy
Performance Eye for the SQL GuyPerformance Eye for the SQL Guy
Performance Eye for the SQL Guy
 
Csql Cache
Csql CacheCsql Cache
Csql Cache
 
Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...
Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...
Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...
 
MongoDB - An Agile NoSQL Database
MongoDB - An Agile NoSQL DatabaseMongoDB - An Agile NoSQL Database
MongoDB - An Agile NoSQL Database
 
Sql implementations
Sql implementationsSql implementations
Sql implementations
 
DMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4Reporting
 
Azure sql database limitations
Azure sql database limitationsAzure sql database limitations
Azure sql database limitations
 
Rdbms vs. no sql
Rdbms vs. no sqlRdbms vs. no sql
Rdbms vs. no sql
 
jdbc
jdbcjdbc
jdbc
 
Windows Azure platform
Windows Azure platformWindows Azure platform
Windows Azure platform
 
Chap3 3 12
Chap3 3 12Chap3 3 12
Chap3 3 12
 
REDIS (Remote Dictionary Server)
REDIS (Remote Dictionary Server)REDIS (Remote Dictionary Server)
REDIS (Remote Dictionary Server)
 
Daten und Verzeichnisse Vergleichen/Synchronisieren mit Beyond Compare (Windo...
Daten und Verzeichnisse Vergleichen/Synchronisieren mit Beyond Compare (Windo...Daten und Verzeichnisse Vergleichen/Synchronisieren mit Beyond Compare (Windo...
Daten und Verzeichnisse Vergleichen/Synchronisieren mit Beyond Compare (Windo...
 
Doxxy: Document and Report generation for Oracle made easy
Doxxy: Document and Report generation for Oracle made easyDoxxy: Document and Report generation for Oracle made easy
Doxxy: Document and Report generation for Oracle made easy
 
Exploring azure cloud storage
Exploring azure cloud storageExploring azure cloud storage
Exploring azure cloud storage
 
SQL vs NoSQL: Big Data Adoption & Success in the Enterprise
SQL vs NoSQL: Big Data Adoption & Success in the EnterpriseSQL vs NoSQL: Big Data Adoption & Success in the Enterprise
SQL vs NoSQL: Big Data Adoption & Success in the Enterprise
 
Latest Advance Animated Ado.Net With JDBC
Latest Advance Animated Ado.Net With JDBC Latest Advance Animated Ado.Net With JDBC
Latest Advance Animated Ado.Net With JDBC
 
Simple Yet Powerful Software and System Requirements Management
Simple Yet Powerful Software and System Requirements ManagementSimple Yet Powerful Software and System Requirements Management
Simple Yet Powerful Software and System Requirements Management
 

Viewers also liked

SQL DAY 2012 | DEV Track | Session 6 - Master Data Management by W.Bielski 6 ...
SQL DAY 2012 | DEV Track | Session 6 - Master Data Management by W.Bielski 6 ...SQL DAY 2012 | DEV Track | Session 6 - Master Data Management by W.Bielski 6 ...
SQL DAY 2012 | DEV Track | Session 6 - Master Data Management by W.Bielski 6 ...Polish SQL Server User Group
 
SQL DAY 2012 | DEV Track | Session 9 - Data Mining Analiza Przepływowa by M.S...
SQL DAY 2012 | DEV Track | Session 9 - Data Mining Analiza Przepływowa by M.S...SQL DAY 2012 | DEV Track | Session 9 - Data Mining Analiza Przepływowa by M.S...
SQL DAY 2012 | DEV Track | Session 9 - Data Mining Analiza Przepływowa by M.S...Polish SQL Server User Group
 
SQLDay2013_MarcinSzeliga_SQLServer2012FastTrackDWReferenceArchitectures
SQLDay2013_MarcinSzeliga_SQLServer2012FastTrackDWReferenceArchitecturesSQLDay2013_MarcinSzeliga_SQLServer2012FastTrackDWReferenceArchitectures
SQLDay2013_MarcinSzeliga_SQLServer2012FastTrackDWReferenceArchitecturesPolish SQL Server User Group
 
SQLDay2013_PawełPotasiński_GeografiaSQLServer2012
SQLDay2013_PawełPotasiński_GeografiaSQLServer2012SQLDay2013_PawełPotasiński_GeografiaSQLServer2012
SQLDay2013_PawełPotasiński_GeografiaSQLServer2012Polish SQL Server User Group
 
CISSPDAY 2011 - 2 AM A Disaster just Began
CISSPDAY 2011 - 2 AM A Disaster just BeganCISSPDAY 2011 - 2 AM A Disaster just Began
CISSPDAY 2011 - 2 AM A Disaster just BeganTobias Koprowski
 
38Spotkanie_PLSSUGweWroclawiu_Keynote
38Spotkanie_PLSSUGweWroclawiu_Keynote38Spotkanie_PLSSUGweWroclawiu_Keynote
38Spotkanie_PLSSUGweWroclawiu_KeynoteTobias Koprowski
 
SQLDay2013_PawełPotasiński_ParallelDataWareHouse
SQLDay2013_PawełPotasiński_ParallelDataWareHouseSQLDay2013_PawełPotasiński_ParallelDataWareHouse
SQLDay2013_PawełPotasiński_ParallelDataWareHousePolish SQL Server User Group
 
26th_Meetup_of_PLSSUG_WROCLAW-ColumnStore_Indexes_byBeataZalewa_scripts
26th_Meetup_of_PLSSUG_WROCLAW-ColumnStore_Indexes_byBeataZalewa_scripts26th_Meetup_of_PLSSUG_WROCLAW-ColumnStore_Indexes_byBeataZalewa_scripts
26th_Meetup_of_PLSSUG_WROCLAW-ColumnStore_Indexes_byBeataZalewa_scriptsPolish SQL Server User Group
 
SQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorld
SQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorldSQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorld
SQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorldPolish SQL Server User Group
 
GoldenLine.pl - Od Startupu do... Startupu :-)
GoldenLine.pl - Od Startupu do... Startupu :-)GoldenLine.pl - Od Startupu do... Startupu :-)
GoldenLine.pl - Od Startupu do... Startupu :-)Karol Traczykowski
 

Viewers also liked (20)

SQLDay2011_Sesja02_Collation_Marek Adamczuk
SQLDay2011_Sesja02_Collation_Marek AdamczukSQLDay2011_Sesja02_Collation_Marek Adamczuk
SQLDay2011_Sesja02_Collation_Marek Adamczuk
 
SQL DAY 2012 | DEV Track | Session 6 - Master Data Management by W.Bielski 6 ...
SQL DAY 2012 | DEV Track | Session 6 - Master Data Management by W.Bielski 6 ...SQL DAY 2012 | DEV Track | Session 6 - Master Data Management by W.Bielski 6 ...
SQL DAY 2012 | DEV Track | Session 6 - Master Data Management by W.Bielski 6 ...
 
SQL DAY 2012 | DEV Track | Session 9 - Data Mining Analiza Przepływowa by M.S...
SQL DAY 2012 | DEV Track | Session 9 - Data Mining Analiza Przepływowa by M.S...SQL DAY 2012 | DEV Track | Session 9 - Data Mining Analiza Przepływowa by M.S...
SQL DAY 2012 | DEV Track | Session 9 - Data Mining Analiza Przepływowa by M.S...
 
Sql day2015 fts
Sql day2015 ftsSql day2015 fts
Sql day2015 fts
 
SQLDay2013_MarcinSzeliga_SQLServer2012FastTrackDWReferenceArchitectures
SQLDay2013_MarcinSzeliga_SQLServer2012FastTrackDWReferenceArchitecturesSQLDay2013_MarcinSzeliga_SQLServer2012FastTrackDWReferenceArchitectures
SQLDay2013_MarcinSzeliga_SQLServer2012FastTrackDWReferenceArchitectures
 
SQLDay2013_PawełPotasiński_GeografiaSQLServer2012
SQLDay2013_PawełPotasiński_GeografiaSQLServer2012SQLDay2013_PawełPotasiński_GeografiaSQLServer2012
SQLDay2013_PawełPotasiński_GeografiaSQLServer2012
 
SQLDay2013_GrzegorzStolecki_KonsolidacjaBI
SQLDay2013_GrzegorzStolecki_KonsolidacjaBISQLDay2013_GrzegorzStolecki_KonsolidacjaBI
SQLDay2013_GrzegorzStolecki_KonsolidacjaBI
 
SQLDay2013_MarcinSzeliga_StoredProcedures
SQLDay2013_MarcinSzeliga_StoredProceduresSQLDay2013_MarcinSzeliga_StoredProcedures
SQLDay2013_MarcinSzeliga_StoredProcedures
 
CISSPDAY 2011 - 2 AM A Disaster just Began
CISSPDAY 2011 - 2 AM A Disaster just BeganCISSPDAY 2011 - 2 AM A Disaster just Began
CISSPDAY 2011 - 2 AM A Disaster just Began
 
SQLDay2013_GrzegorzStolecki_RealTimeOLAP
SQLDay2013_GrzegorzStolecki_RealTimeOLAPSQLDay2013_GrzegorzStolecki_RealTimeOLAP
SQLDay2013_GrzegorzStolecki_RealTimeOLAP
 
SQLDay2013_ChrisWebb_DAXMD
SQLDay2013_ChrisWebb_DAXMDSQLDay2013_ChrisWebb_DAXMD
SQLDay2013_ChrisWebb_DAXMD
 
SQLDay2013_MarekAdamczuk_Kursory
SQLDay2013_MarekAdamczuk_KursorySQLDay2013_MarekAdamczuk_Kursory
SQLDay2013_MarekAdamczuk_Kursory
 
38Spotkanie_PLSSUGweWroclawiu_Keynote
38Spotkanie_PLSSUGweWroclawiu_Keynote38Spotkanie_PLSSUGweWroclawiu_Keynote
38Spotkanie_PLSSUGweWroclawiu_Keynote
 
SQLDay2013_PawełPotasiński_ParallelDataWareHouse
SQLDay2013_PawełPotasiński_ParallelDataWareHouseSQLDay2013_PawełPotasiński_ParallelDataWareHouse
SQLDay2013_PawełPotasiński_ParallelDataWareHouse
 
26th_Meetup_of_PLSSUG_WROCLAW-ColumnStore_Indexes_byBeataZalewa_scripts
26th_Meetup_of_PLSSUG_WROCLAW-ColumnStore_Indexes_byBeataZalewa_scripts26th_Meetup_of_PLSSUG_WROCLAW-ColumnStore_Indexes_byBeataZalewa_scripts
26th_Meetup_of_PLSSUG_WROCLAW-ColumnStore_Indexes_byBeataZalewa_scripts
 
SQLDay2013_ChrisWebb_SSASDesignMistakes
SQLDay2013_ChrisWebb_SSASDesignMistakesSQLDay2013_ChrisWebb_SSASDesignMistakes
SQLDay2013_ChrisWebb_SSASDesignMistakes
 
SQLDay2013_MaciejPilecki_Lock&Latches
SQLDay2013_MaciejPilecki_Lock&LatchesSQLDay2013_MaciejPilecki_Lock&Latches
SQLDay2013_MaciejPilecki_Lock&Latches
 
SQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorld
SQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorldSQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorld
SQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorld
 
SQLDay2013_ChrisWebb_CubeDesign&PerformanceTuning
SQLDay2013_ChrisWebb_CubeDesign&PerformanceTuningSQLDay2013_ChrisWebb_CubeDesign&PerformanceTuning
SQLDay2013_ChrisWebb_CubeDesign&PerformanceTuning
 
GoldenLine.pl - Od Startupu do... Startupu :-)
GoldenLine.pl - Od Startupu do... Startupu :-)GoldenLine.pl - Od Startupu do... Startupu :-)
GoldenLine.pl - Od Startupu do... Startupu :-)
 

Similar to SQLDay2013_Denny Cherry - Table indexing for the .NET Developer

Database Indexes
Database IndexesDatabase Indexes
Database IndexesSperasoft
 
Sql query performance analysis
Sql query performance analysisSql query performance analysis
Sql query performance analysisRiteshkiit
 
Sql query performance analysis
Sql query performance analysisSql query performance analysis
Sql query performance analysisRiteshkiit
 
Querying_with_T-SQL_-_01.pptx
Querying_with_T-SQL_-_01.pptxQuerying_with_T-SQL_-_01.pptx
Querying_with_T-SQL_-_01.pptxQuyVo27
 
Building better SQL Server Databases
Building better SQL Server DatabasesBuilding better SQL Server Databases
Building better SQL Server DatabasesColdFusionConference
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQLTony Tam
 
Top 10 tips for Oracle performance (Updated April 2015)
Top 10 tips for Oracle performance (Updated April 2015)Top 10 tips for Oracle performance (Updated April 2015)
Top 10 tips for Oracle performance (Updated April 2015)Guy Harrison
 
SAG_Indexing and Query Optimization
SAG_Indexing and Query OptimizationSAG_Indexing and Query Optimization
SAG_Indexing and Query OptimizationVaibhav Jain
 
php databse handling
php databse handlingphp databse handling
php databse handlingkunj desai
 
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
 
U-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersU-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersMichael Rys
 
SQL Explore 2012: P&T Part 2
SQL Explore 2012: P&T Part 2SQL Explore 2012: P&T Part 2
SQL Explore 2012: P&T Part 2sqlserver.co.il
 
3 CityNetConf - sql+c#=u-sql
3 CityNetConf - sql+c#=u-sql3 CityNetConf - sql+c#=u-sql
3 CityNetConf - sql+c#=u-sqlŁukasz Grala
 
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-SQLMichael Rys
 

Similar to SQLDay2013_Denny Cherry - Table indexing for the .NET Developer (20)

Database Indexes
Database IndexesDatabase Indexes
Database Indexes
 
Statistics and Indexes Internals
Statistics and Indexes InternalsStatistics and Indexes Internals
Statistics and Indexes Internals
 
Sql query performance analysis
Sql query performance analysisSql query performance analysis
Sql query performance analysis
 
Tunning overview
Tunning overviewTunning overview
Tunning overview
 
Sql query performance analysis
Sql query performance analysisSql query performance analysis
Sql query performance analysis
 
Querying_with_T-SQL_-_01.pptx
Querying_with_T-SQL_-_01.pptxQuerying_with_T-SQL_-_01.pptx
Querying_with_T-SQL_-_01.pptx
 
Rdbms
RdbmsRdbms
Rdbms
 
JSSUG: SQL Sever Index Tuning
JSSUG: SQL Sever Index TuningJSSUG: SQL Sever Index Tuning
JSSUG: SQL Sever Index Tuning
 
Building better SQL Server Databases
Building better SQL Server DatabasesBuilding better SQL Server Databases
Building better SQL Server Databases
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQL
 
Top 10 tips for Oracle performance (Updated April 2015)
Top 10 tips for Oracle performance (Updated April 2015)Top 10 tips for Oracle performance (Updated April 2015)
Top 10 tips for Oracle performance (Updated April 2015)
 
Sql Server2008
Sql Server2008Sql Server2008
Sql Server2008
 
SAG_Indexing and Query Optimization
SAG_Indexing and Query OptimizationSAG_Indexing and Query Optimization
SAG_Indexing and Query Optimization
 
MS ACCESS.pptx
MS ACCESS.pptxMS ACCESS.pptx
MS ACCESS.pptx
 
php databse handling
php databse handlingphp databse handling
php databse handling
 
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…
 
U-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersU-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for Developers
 
SQL Explore 2012: P&T Part 2
SQL Explore 2012: P&T Part 2SQL Explore 2012: P&T Part 2
SQL Explore 2012: P&T Part 2
 
3 CityNetConf - sql+c#=u-sql
3 CityNetConf - sql+c#=u-sql3 CityNetConf - sql+c#=u-sql
3 CityNetConf - sql+c#=u-sql
 
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
 

More from Polish SQL Server User Group

SQL DAY 2012 | DEV Track | Session 8 - Getting Dimension with Data by C.Tecta...
SQL DAY 2012 | DEV Track | Session 8 - Getting Dimension with Data by C.Tecta...SQL DAY 2012 | DEV Track | Session 8 - Getting Dimension with Data by C.Tecta...
SQL DAY 2012 | DEV Track | Session 8 - Getting Dimension with Data by C.Tecta...Polish SQL Server User Group
 
26th_Meetup_of_PLSSUG-ColumnStore_Indexes_byBeataZalewa_session
26th_Meetup_of_PLSSUG-ColumnStore_Indexes_byBeataZalewa_session26th_Meetup_of_PLSSUG-ColumnStore_Indexes_byBeataZalewa_session
26th_Meetup_of_PLSSUG-ColumnStore_Indexes_byBeataZalewa_sessionPolish SQL Server User Group
 
SQLDay2011_Sesja03_Fakty,MiaryISwiatRealny_GrzegorzStolecki
SQLDay2011_Sesja03_Fakty,MiaryISwiatRealny_GrzegorzStoleckiSQLDay2011_Sesja03_Fakty,MiaryISwiatRealny_GrzegorzStolecki
SQLDay2011_Sesja03_Fakty,MiaryISwiatRealny_GrzegorzStoleckiPolish SQL Server User Group
 
SQLDay2011_Sesja01_ModelowanieIZasilanieWymiarówHurtowniDanych_ŁukaszGrala
SQLDay2011_Sesja01_ModelowanieIZasilanieWymiarówHurtowniDanych_ŁukaszGralaSQLDay2011_Sesja01_ModelowanieIZasilanieWymiarówHurtowniDanych_ŁukaszGrala
SQLDay2011_Sesja01_ModelowanieIZasilanieWymiarówHurtowniDanych_ŁukaszGralaPolish SQL Server User Group
 
SQLDay2011_Sesja05_MicrosoftSQLServerExecutionPlansFromCompilationToCachingTo...
SQLDay2011_Sesja05_MicrosoftSQLServerExecutionPlansFromCompilationToCachingTo...SQLDay2011_Sesja05_MicrosoftSQLServerExecutionPlansFromCompilationToCachingTo...
SQLDay2011_Sesja05_MicrosoftSQLServerExecutionPlansFromCompilationToCachingTo...Polish SQL Server User Group
 
How to tune a database application without changing a single query - Maciej P...
How to tune a database application without changing a single query - Maciej P...How to tune a database application without changing a single query - Maciej P...
How to tune a database application without changing a single query - Maciej P...Polish SQL Server User Group
 
Co nowego w SQL Server 11 – Denali CTP1 - Grzegorz Stolecki, Łukasz Grala i K...
Co nowego w SQL Server 11 – Denali CTP1 - Grzegorz Stolecki, Łukasz Grala i K...Co nowego w SQL Server 11 – Denali CTP1 - Grzegorz Stolecki, Łukasz Grala i K...
Co nowego w SQL Server 11 – Denali CTP1 - Grzegorz Stolecki, Łukasz Grala i K...Polish SQL Server User Group
 
Master Data Services – Po co nam kolejna usługa w Sql Server - Mariusz Koprowski
Master Data Services – Po co nam kolejna usługa w Sql Server - Mariusz KoprowskiMaster Data Services – Po co nam kolejna usługa w Sql Server - Mariusz Koprowski
Master Data Services – Po co nam kolejna usługa w Sql Server - Mariusz KoprowskiPolish SQL Server User Group
 

More from Polish SQL Server User Group (9)

SQLDay2013_MarcinSzeliga_DataInDataMining
SQLDay2013_MarcinSzeliga_DataInDataMiningSQLDay2013_MarcinSzeliga_DataInDataMining
SQLDay2013_MarcinSzeliga_DataInDataMining
 
SQL DAY 2012 | DEV Track | Session 8 - Getting Dimension with Data by C.Tecta...
SQL DAY 2012 | DEV Track | Session 8 - Getting Dimension with Data by C.Tecta...SQL DAY 2012 | DEV Track | Session 8 - Getting Dimension with Data by C.Tecta...
SQL DAY 2012 | DEV Track | Session 8 - Getting Dimension with Data by C.Tecta...
 
26th_Meetup_of_PLSSUG-ColumnStore_Indexes_byBeataZalewa_session
26th_Meetup_of_PLSSUG-ColumnStore_Indexes_byBeataZalewa_session26th_Meetup_of_PLSSUG-ColumnStore_Indexes_byBeataZalewa_session
26th_Meetup_of_PLSSUG-ColumnStore_Indexes_byBeataZalewa_session
 
SQLDay2011_Sesja03_Fakty,MiaryISwiatRealny_GrzegorzStolecki
SQLDay2011_Sesja03_Fakty,MiaryISwiatRealny_GrzegorzStoleckiSQLDay2011_Sesja03_Fakty,MiaryISwiatRealny_GrzegorzStolecki
SQLDay2011_Sesja03_Fakty,MiaryISwiatRealny_GrzegorzStolecki
 
SQLDay2011_Sesja01_ModelowanieIZasilanieWymiarówHurtowniDanych_ŁukaszGrala
SQLDay2011_Sesja01_ModelowanieIZasilanieWymiarówHurtowniDanych_ŁukaszGralaSQLDay2011_Sesja01_ModelowanieIZasilanieWymiarówHurtowniDanych_ŁukaszGrala
SQLDay2011_Sesja01_ModelowanieIZasilanieWymiarówHurtowniDanych_ŁukaszGrala
 
SQLDay2011_Sesja05_MicrosoftSQLServerExecutionPlansFromCompilationToCachingTo...
SQLDay2011_Sesja05_MicrosoftSQLServerExecutionPlansFromCompilationToCachingTo...SQLDay2011_Sesja05_MicrosoftSQLServerExecutionPlansFromCompilationToCachingTo...
SQLDay2011_Sesja05_MicrosoftSQLServerExecutionPlansFromCompilationToCachingTo...
 
How to tune a database application without changing a single query - Maciej P...
How to tune a database application without changing a single query - Maciej P...How to tune a database application without changing a single query - Maciej P...
How to tune a database application without changing a single query - Maciej P...
 
Co nowego w SQL Server 11 – Denali CTP1 - Grzegorz Stolecki, Łukasz Grala i K...
Co nowego w SQL Server 11 – Denali CTP1 - Grzegorz Stolecki, Łukasz Grala i K...Co nowego w SQL Server 11 – Denali CTP1 - Grzegorz Stolecki, Łukasz Grala i K...
Co nowego w SQL Server 11 – Denali CTP1 - Grzegorz Stolecki, Łukasz Grala i K...
 
Master Data Services – Po co nam kolejna usługa w Sql Server - Mariusz Koprowski
Master Data Services – Po co nam kolejna usługa w Sql Server - Mariusz KoprowskiMaster Data Services – Po co nam kolejna usługa w Sql Server - Mariusz Koprowski
Master Data Services – Po co nam kolejna usługa w Sql Server - Mariusz Koprowski
 

Recently uploaded

HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 

Recently uploaded (20)

HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 

SQLDay2013_Denny Cherry - Table indexing for the .NET Developer

  • 1. Table Indexing for the .NET Developer Denny Cherry mrdenny@dcac.co twitter.com/mrdenny
  • 2. About Me • • • • • • • • Denny Cherry & Associates Consulting Author or Coauthor of 7 books 8+ SQL Mag articles Dozens of other articles Microsoft MVP Microsoft Certified Master VMware vExpert Microsoft Certified Trainer 2
  • 3. Today’s Goals • • • • • Introduce the different kinds of indexes Common Misconceptions about indexes Downsides to indexes Introduce advanced index tuning techniques Q&A
  • 4. Today’s Goals • • • • • Introduce the different kinds of indexes Common Misconceptions about indexes Downsides to indexes Introduce advanced index tuning techniques Q&A
  • 5. Different Kinds of Indexes • Five Kinds of Indexes – – – – – Clustered Non-clustered Full Text XML ColumnStore Indexes • There’s new stuff coming in SQL Server 2012 – Semantic Search
  • 6. Clustered Indexes • 1 Clustered Index per table • Contain Full Copy of row data within in the index • Up to 16 indexed columns can be part of the index – (15 if the table contains any XML indexes) • • • • Primary Key will by default be the Clustered Index Must be created on the same filegroup as the table Clustered Indexes should be as narrow as possible While not required, they are highly recommended
  • 7. Non-clustered Index • Up to 999 per table Starting with SQL Server 2008 – 255 in SQL Server 2005 and below • Up to 16 indexed columns in the index • Non-indexed columns can be included via INCLUDE statement • Non-Clustered indexes always contain the clustered index columns (when table has a clustered index) • When table is a heap, the Row ID is stored in every nonclustered index. • Can be created on any filegroup within the database • Can be filtered indexes to include fewer rows in the index.
  • 8. Differences between unique and nonunique clustered indexes • Non-Unique clustered indexes have an extra column called the uniqueifier which ensures that values within the index are unique. • Uniqueifier is only used for rows which are not unique. EmpId Uniqufier 1 2 3 4 0 4 1 5 6 7 0 7 1 8
  • 9. Full Text Indexes • Not accessed via normal SELECT statements • Require use of a predicate: – – – – CONTAINS CONTAINSTABLE FREETEXT FREETEXTTABLE • Can be used to search binary values (doc, docx, xls, pdf) stored within the database. • Natural Language Search • Can index XML documents, but only indexes the values, not the tags.
  • 10. Full Text Indexes (SQL 2005 and below) • Created and managed outside of the database via Microsoft Search Service • Backed up with the database (starting in SQL 2005) • Searches entire index and returns all matches, which you then filter against your normal table to return correct set of rows.
  • 11. Full Text Indexes (SQL 2008 and up) • Now stored within the database • Command is still parsed via MS Search service, but looking is done natively • Full text search now only searches the required subset of rows • When creating your indexes use an identity field as the key to improve query performance.
  • 12. XML Indexes • Allows you to index specific nodes of the XML document • 249 XML Indexes pre table • Requires a Clustered Index on the table • Each xml column can have a single primary XML index and multiple secondary XML indexes • XML Indexes can only be created on a single XML Column • No online rebuilds • Not available for XML variables. Only used on tables.
  • 13. Primary XML Index • When created creates a hidden node table – Contains base table primary key and 12 columns of info about every node within the XML value • Effectively the clustered index on the node table – Base Table Clustered Index Value – Node id from the node table • Increases storage 200-500%
  • 14. Secondary XML Indexes • Non-Clustered Indexes on the hidden node table • Three kinds of secondary indexes – PATH index on the node id (path) and the value – VALUE index is on the value and the node id (path) – PROPERTY index is on the base table’s clustered index, node id (path) and the value
  • 15. Today’s Goals • • • • • Introduce the different kinds of indexes Common Misconceptions about indexes Downsides to indexes Introduce advanced index tuning techniques Q&A
  • 16. Common Misconceptions about indexes • Indexes don’t require maintenance • If I create one index for each column in my where clause I’ll be fine • The table is sorted based on the order of the Clustered Index • Clustered Indexes are required
  • 17. Today’s Goals • • • • • Introduce the different kinds of indexes Common Misconceptions about indexes Downsides to indexes Introduce advanced index tuning techniques Q&A
  • 18. Downsides to indexes • Indexes take up space – On large complex databases the indexes can take up more space than the table – Data is duplicated in each index which contains the column • Indexes slow down insert, update, delete (especially full text indexes) statements • Using the wrong index can be slower than using no index • Encrypted data can’t be effectively indexed
  • 19. Today’s Goals • • • • • Introduce the different kinds of indexes Common Misconceptions about indexes Downsides to indexes Introduce advanced index tuning techniques Q&A
  • 20. Advanced Index Tuning Techniques • Fillfactor – Tells the SQL Server how much free space to leave in the leaf level pages. • Padding – Tells the SQL Server to use the Fillfactor setting to leave free space in the intermediate-level pages. • Online Rebuilds • Data Compression
  • 21. What is a ColumnStore Index? • Totally new and different approach to indexing • Data is stored via columns not rows • Each column is stored separately, then compressed using VertiPak compression engine • SQL Server’s first B-Tree less index
  • 22. How does ColumnStore do that? C1 C2 C3 C4 C5 C6
  • 23. ColumnStore: Use Case • Data continues to grow, but performance requirements stay the same • Many data warehouses approach PB ranges • Data needs to be filtered, aggregated, and grouped despite the size of the dataset
  • 24. Limitations • Unsupported Data Types include – Uniqueidentifier – Blob – Numeric (19,2) or higher • Read Only • OUTER JOINs using ColumnStore don’t perform well
  • 25. Using the Advanced Index Tuning Techniques CREATE INDEX MyIndex ON dbo.MyTable ON (Col1, Col5, Col3) INCLUDE (Col4, Col2) WHERE Col6 = ‘Value3’ WITH (FILLFACTOR=70, PAD_INDEX=ON, ONLINE=ON, DATA_COMPRESSION = ROW | PAGE);
  • 26. Physical Index B-Tree Layout Clustered (BOL 2005 / 2008) Non-Clustered (BOL 2005 / 2008)
  • 27. How large are my indexes? • SELECT * • FROM sys.dm_db_index_physical_stats (db_id(), object_id(‘table_name’), null, null, ‘detailed’) – – – – – Database Id Object Id Index Id Partition Number Mode (NULL | Limited, Sampled, Detailed)
  • 28. What Indexes are being used? • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • DECLARE @dbid INT , @dbName VARCHAR(100); SELECT @dbid = DB_ID() , @dbName = DB_NAME(); WITH partitionCTE (OBJECT_ID, index_id, row_count, partition_count) AS ( SELECT [OBJECT_ID] , index_id , SUM([ROWS]) AS 'row_count' , COUNT(partition_id) AS 'partition_count' FROM sys.partitions GROUP BY [OBJECT_ID] , index_id ) SELECT OBJECT_NAME(i.[OBJECT_ID]) AS objectName , i.name , CASE WHEN i.is_unique = 1 THEN 'UNIQUE ' ELSE '' END + i.type_desc AS 'indexType' , ddius.user_seeks , ddius.user_scans , ddius.user_lookups , ddius.user_updates , cte.row_count , CASE WHEN partition_count > 1 THEN 'yes' ELSE 'no' END AS 'partitioned?' , CASE WHEN i.type = 2 And i.is_unique = 0 THEN 'Drop Index ' + i.name + ' On ' + @dbName + '.dbo.' + OBJECT_NAME(ddius.[OBJECT_ID]) + ';' WHEN i.type = 2 And i.is_unique = 1 THEN 'Alter Table ' + @dbName + '.dbo.' + OBJECT_NAME(ddius.[OBJECT_ID]) + ' Drop Constraint ' + i.name + ';' ELSE '' END AS 'SQL_DropStatement' FROM sys.indexes AS i INNER Join sys.dm_db_index_usage_stats ddius ON i.OBJECT_ID = ddius.OBJECT_ID And i.index_id = ddius.index_id INNER Join partitionCTE AS cte ON i.OBJECT_ID = cte.OBJECT_ID And i.index_id = cte.index_id WHERE ddius.database_id = @dbid ORDER BY 1, (ddius.user_seeks + ddius.user_scans + ddius.user_lookups) ASC , user_updates DESC;
  • 30. Q&A