Expert performance indexing for SQL Server 2012 9781430237419, 9781430237426, 1430237414, 1430237422

Expert Performance Indexing for SQL Server 2012is a deep dive into perhaps the single-most important facet of good perfo

391 87 28MB

English Pages 354 [344] Year 2012

Report DMCA / Copyright

DOWNLOAD FILE

Expert performance indexing for SQL Server 2012
 9781430237419, 9781430237426, 1430237414, 1430237422

Table of contents :
Title Page......Page 2
Copyright Page......Page 3
Contents at a Glance......Page 5
Table of Contents......Page 6
About the Author......Page 13
About the Technical Reviewer......Page 14
Acknowledgments......Page 15
Introduction......Page 16
Why Build Indexes?......Page 18
Clustered Indexes......Page 19
Column Store Indexes......Page 20
Spatial Indexes......Page 21
Unique Index......Page 22
Filtered Indexes......Page 23
Index Data Definition Language......Page 24
Creating an Index......Page 25
Dropping an Index......Page 27
sys.indexes......Page 28
Summary......Page 29
Pages......Page 31
Extents......Page 32
Page Types......Page 33
File Header Page......Page 34
Global Allocation Map Page......Page 35
Bulk Changed Map Page......Page 36
Large Object Page......Page 37
Heap Structure......Page 38
B-Tree Structure......Page 40
Column Store Structure......Page 41
DBCC EXTENTINFO......Page 43
DBCC IND......Page 47
DBCC PAGE......Page 51
Page Header Only Print Option......Page 53
Hex Rows Print Option......Page 55
Hex Data Print Option......Page 56
Row Data Print Option......Page 58
Page Fragmentation......Page 59
Forwarded Records......Page 60
Page Splits......Page 61
Non-Clustered Index......Page 64
Summary......Page 65
DBCC SHOW_STATISTICS......Page 66
Histogram......Page 67
Density Vector......Page 70
sys.stat_columns......Page 71
Usage Statistics......Page 72
User Columns......Page 73
System Columns......Page 79
Operational Statistics......Page 81
DML Activity......Page 82
Range Scan......Page 85
Forwarded Fetch......Page 86
Locking Contention......Page 87
Row Lock......Page 88
Page Lock......Page 89
Lock Escalation......Page 90
Latch Contention......Page 91
Page I/O Latch......Page 92
Page Latch......Page 94
Page Allocation Cycle......Page 95
Compression......Page 97
LOB Access......Page 98
Physical Statistics......Page 100
Header Columns......Page 101
Row Statistics......Page 102
Fragmentation Statistics......Page 103
Summary......Page 104
Benefits......Page 105
Creating an XML Index......Page 106
Effects on Execution Plans......Page 109
Effects from a Secondary Index......Page 111
How Spatial Data Is Indexed......Page 115
Creating Spatial Indexes......Page 116
Supporting Methods with Indexes......Page 121
The Views......Page 123
The Procedures......Page 124
Restrictions on Spatial Indexes......Page 125
Creating a Full-Text Example......Page 126
Syntax......Page 127
StopLists......Page 129
Full-Text Search Index Catalog Views and Properties......Page 132
Summary......Page 134
Index Myths......Page 135
Myth 1: Databases Don’t Need Indexes......Page 136
Myth 2: Primary Keys Are Always Clustered......Page 137
Myth 3: Online Index Operations Don’t Block......Page 139
Myth 4: Any Column Can Be Filtered In Multicolumn Indexes......Page 141
Myth 5: Clustered Indexes Store Records in Physical Order......Page 143
Myth 6: Fill Factor Is Applied to Indexes During Inserts......Page 144
Myth 7: Every Table Should Have a Heap/Clustered Index......Page 145
Index Best Practices......Page 146
Database Level Fill Factor......Page 147
Summary......Page 148
Fragmentation Operations......Page 149
Insert Operations......Page 150
Update Operations......Page 152
Delete Operations......Page 154
Shrink Operations......Page 156
Index I/O......Page 158
Defragmentation Options......Page 160
Index Rebuild......Page 161
Index Reorganization......Page 162
Reorganize Index Task......Page 163
Rebuild Index Task......Page 164
T-SQL Scripts......Page 166
Fill Factor......Page 170
Default Values......Page 171
Automatic Updating......Page 172
Maintenance Plans......Page 173
DDL Command......Page 175
Summary......Page 177
Missing Index DMOs......Page 178
sys.dm_db_missing_index_details......Page 179
sys.dm_db_missing_index_columns......Page 180
sys.dm_db_missing_index_group_stats......Page 181
Using the DMOs......Page 182
Database Engine Tuning Advisor......Page 185
Explaining DTA......Page 186
Using the DTA GUI......Page 187
Using the DTA Utility......Page 191
Summary......Page 199
Temporary Objects......Page 200
Other Heap Scenarios......Page 202
Clustered Indexes......Page 203
Identity Column......Page 204
Surrogate Key......Page 205
Foreign Key......Page 207
Multiple Column......Page 211
Globally Unique Identifier......Page 215
Non-Clustered Indexes......Page 217
Search Columns......Page 218
Index Intersection......Page 220
Multiple Columns......Page 223
Covering Index......Page 224
Included Columns......Page 225
Filtered Indexes......Page 229
Foreign Keys......Page 232
ColumnStore Index......Page 236
Index Storage Strategies......Page 238
Row Compression......Page 239
Page Compression......Page 241
Indexed Views......Page 244
Summary......Page 247
LIKE Comparison......Page 248
Concatenation......Page 251
Computed Columns......Page 253
Scalar Functions......Page 255
Data Conversion......Page 257
Summary......Page 260
Indexing Method......Page 262
Monitor......Page 263
Performance Counters......Page 264
Index Usage Stats......Page 269
Index Operational Stats......Page 273
Index Physical Stats......Page 281
Wait Statistics......Page 283
Data Cleanup......Page 286
SQL Trace......Page 287
Analyze......Page 291
Performance Counters......Page 292
Access Methods\Forwarded Records/sec......Page 293
Access Methods\FreeSpace Scans/sec......Page 296
Access Methods\Full Scans/sec......Page 298
Access Methods\Index Searches/sec......Page 300
Access Methods\Page Splits/sec......Page 302
Buffer Manager\Page lookups/sec......Page 304
Locks(*)\Lock Wait Time (ms)......Page 306
Locks(*)\Lock Waits/sec......Page 308
Locks(*)\Number of Deadlocks/sec......Page 310
Wait Statistics......Page 312
CXPACKET......Page 314
LCK_M_*......Page 318
PAGEIOLATCH_*......Page 319
Buffer Allocation......Page 320
Identify Heaps......Page 322
Duplicate Indexes......Page 323
Overlapping Indexes......Page 325
Unindexed Foreign Keys......Page 326
Database Engine Tuning Advisor......Page 328
Unused Indexes......Page 331
Index Plan Usage......Page 332
Communication......Page 333
Status Report......Page 334
Peer Review with Impact Analysis......Page 335
Repeat......Page 336
Summary......Page 337
Index......Page 338

Polecaj historie