Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Apress
committed
Oct 16, 2016
0 parents
commit 0841d14
Showing
279 changed files
with
6,032 additions
and
0 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Freeware License, some rights reserved | ||
|
||
Copyright (c) 2012 Jason Strate and Ted Krueger | ||
|
||
Permission is hereby granted, free of charge, to anyone obtaining a copy | ||
of this software and associated documentation files (the "Software"), | ||
to work with the Software within the limits of freeware distribution and fair use. | ||
This includes the rights to use, copy, and modify the Software for personal use. | ||
Users are also allowed and encouraged to submit corrections and modifications | ||
to the Software for the benefit of other users. | ||
|
||
It is not allowed to reuse, modify, or redistribute the Software for | ||
commercial use in any way, or for a user�s educational materials such as books | ||
or blog articles without prior permission from the copyright holder. | ||
|
||
The above copyright notice and this permission notice need to be included | ||
in all copies or substantial portions of the software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
|
13 changes: 13 additions & 0 deletions
13
Performance Indexing - Chapter 01/Chapter 01 - Listing 1-01.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--Listing 1-1. CREATE INDEX Syntax | ||
CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name | ||
ON <object> ( column [ ASC | DESC ] [ ,…n ] ) | ||
[ INCLUDE ( column_name [ ,…n ] ) ] | ||
[ WHERE <?lter_predicate> ] | ||
[ WITH ( <relational_index_option> [ ,…n ] ) ] | ||
[ ON { partition_scheme_name ( column_name ) | ||
| ?legroup_name | ||
| default | ||
} | ||
] | ||
[ FILESTREAM_ON { ?lestream_?legroup_name | partition_scheme_name | "NULL" } ] | ||
[ ; ] |
14 changes: 14 additions & 0 deletions
14
Performance Indexing - Chapter 01/Chapter 01 - Listing 1-02.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--Listing 1-2. Index Options | ||
PAD_INDEX = { ON | OFF } | ||
| FILLFACTOR = ?llfactor | ||
| SORT_IN_TEMPDB = { ON | OFF } | ||
| IGNORE_DUP_KEY = { ON | OFF } | ||
| STATISTICS_NORECOMPUTE = { ON | OFF } | ||
| DROP_EXISTING = { ON | OFF } | ||
| ONLINE = { ON | OFF } | ||
| ALLOW_ROW_LOCKS = { ON | OFF } | ||
| ALLOW_PAGE_LOCKS = { ON | OFF } | ||
| MAXDOP = max_degree_of_parallelism | ||
| DATA_COMPRESSION = { NONE | ROW | PAGE} | ||
[ ON PARTITIONS ( { <partition_number_expression> | <range> } | ||
[ , …n ] ) ] |
19 changes: 19 additions & 0 deletions
19
Performance Indexing - Chapter 01/Chapter 01 - Listing 1-03.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--Listing 1-3. ALTER INDEX Syntax | ||
ALTER INDEX { index_name | ALL } | ||
ON <object> | ||
{ REBUILD | ||
[ [PARTITION = ALL] | ||
[ WITH ( <rebuild_index_option> [ ,…n ] ) ] | ||
| [ PARTITION = partition_number | ||
[ WITH ( <single_partition_rebuild_index_option> | ||
[ ,…n ] ) | ||
] | ||
] | ||
] | ||
| DISABLE | ||
| REORGANIZE | ||
[ PARTITION = partition_number ] | ||
[ WITH ( LOB_COMPACTION = { ON | OFF } ) ] | ||
| SET ( <set_index_option> [ ,…n ] ) | ||
} | ||
[ ; ] |
4 changes: 4 additions & 0 deletions
4
Performance Indexing - Chapter 01/Chapter 01 - Listing 1-04.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--Listing 1-4. DROP INDEX Syntax | ||
DROP INDEX | ||
index_name ON <object> | ||
[ WITH ( <drop_clustered_index_option> [ ,…n ] ) ] |
10 changes: 10 additions & 0 deletions
10
Performance Indexing - Chapter 01/Chapter 01 - Listing 1-05.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--Listing 1-5. DROP INDEX Options | ||
MAXDOP = max_degree_of_parallelism | ||
| ONLINE = { ON | OFF } | ||
| MOVE TO { partition_scheme_name ( column_name ) | ||
| ?legroup_name | ||
| "default" | ||
} | ||
[ FILESTREAM_ON { partition_scheme_name | ||
| ?lestream_?legroup_name | ||
| "default" } ] |
Binary file added
BIN
+12.5 KB
Performance Indexing - Chapter 01/Performance Indexing - Chapter 01.ssms_suo
Binary file not shown.
16 changes: 16 additions & 0 deletions
16
Performance Indexing - Chapter 01/Performance Indexing - Chapter 01.ssmssln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# SQL Server Management Studio Solution File, Format Version 11.00 | ||
Project("{4F2E2C19-372F-40D8-9FA7-9D2138C6997A}") = "Performance Indexing - Chapter 01", "Performance Indexing - Chapter 01.ssmssqlproj", "{648B8869-B6F9-4AC5-A36B-2E2059141C1A}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Default|Default = Default|Default | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{648B8869-B6F9-4AC5-A36B-2E2059141C1A}.Default|Default.ActiveCfg = Default | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
58 changes: 58 additions & 0 deletions
58
Performance Indexing - Chapter 01/Performance Indexing - Chapter 01.ssmssqlproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0"?> | ||
<SqlWorkbenchSqlProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="Performance Indexing - Chapter 01"> | ||
<Items> | ||
<LogicalFolder Name="Connections" Type="2" Sorted="true"> | ||
<Items> | ||
<ConnectionNode Name="FL-WS-CON-JS01:PWCORP\jstrate"> | ||
<Created>2013-06-13T11:30:26.6896776-04:00</Created> | ||
<Type>SQL</Type> | ||
<Server>FL-WS-CON-JS01</Server> | ||
<UserName /> | ||
<Authentication>Windows Authentication</Authentication> | ||
<InitialDB /> | ||
<LoginTimeout>15</LoginTimeout> | ||
<ExecutionTimeout>0</ExecutionTimeout> | ||
<ConnectionProtocol>NotSpecified</ConnectionProtocol> | ||
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName> | ||
</ConnectionNode> | ||
</Items> | ||
</LogicalFolder> | ||
<LogicalFolder Name="Queries" Type="0" Sorted="true"> | ||
<Items> | ||
<FileNode Name="Chapter 01 - Listing 1-01.sql"> | ||
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:FL-WS-CON-JS01:True</AssociatedConnectionMoniker> | ||
<AssociatedConnSrvName>FL-WS-CON-JS01</AssociatedConnSrvName> | ||
<AssociatedConnUserName /> | ||
<FullPath>Chapter 01 - Listing 1-01.sql</FullPath> | ||
</FileNode> | ||
<FileNode Name="Chapter 01 - Listing 1-02.sql"> | ||
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:FL-WS-CON-JS01:True</AssociatedConnectionMoniker> | ||
<AssociatedConnSrvName>FL-WS-CON-JS01</AssociatedConnSrvName> | ||
<AssociatedConnUserName /> | ||
<FullPath>Chapter 01 - Listing 1-02.sql</FullPath> | ||
</FileNode> | ||
<FileNode Name="Chapter 01 - Listing 1-03.sql"> | ||
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:FL-WS-CON-JS01:True</AssociatedConnectionMoniker> | ||
<AssociatedConnSrvName>FL-WS-CON-JS01</AssociatedConnSrvName> | ||
<AssociatedConnUserName /> | ||
<FullPath>Chapter 01 - Listing 1-03.sql</FullPath> | ||
</FileNode> | ||
<FileNode Name="Chapter 01 - Listing 1-04.sql"> | ||
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:FL-WS-CON-JS01:True</AssociatedConnectionMoniker> | ||
<AssociatedConnSrvName>FL-WS-CON-JS01</AssociatedConnSrvName> | ||
<AssociatedConnUserName /> | ||
<FullPath>Chapter 01 - Listing 1-04.sql</FullPath> | ||
</FileNode> | ||
<FileNode Name="Chapter 01 - Listing 1-05.sql"> | ||
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:FL-WS-CON-JS01:True</AssociatedConnectionMoniker> | ||
<AssociatedConnSrvName>FL-WS-CON-JS01</AssociatedConnSrvName> | ||
<AssociatedConnUserName /> | ||
<FullPath>Chapter 01 - Listing 1-05.sql</FullPath> | ||
</FileNode> | ||
</Items> | ||
</LogicalFolder> | ||
<LogicalFolder Name="Miscellaneous" Type="3" Sorted="true"> | ||
<Items /> | ||
</LogicalFolder> | ||
</Items> | ||
</SqlWorkbenchSqlProject> |
4 changes: 4 additions & 0 deletions
4
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-01.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--Listing 2-1. DBCC EXTENTINFO Syntax | ||
DBCC EXTENTINFO ( {database_name | database_id | 0} | ||
, {table_name | table_object_id}, { index_name | index_id | -1} | ||
, { partition_id | 0} |
16 changes: 16 additions & 0 deletions
16
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-02.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--Listing 2-2. DBCC EXTENTINFO Example One | ||
USE master | ||
GO | ||
CREATE DATABASE Chapter2Internals | ||
GO | ||
USE Chapter2Internals | ||
GO | ||
CREATE TABLE dbo.IndexInternalsOne | ||
( | ||
RowID INT IDENTITY(1,1) | ||
,FillerData CHAR(8000) | ||
) | ||
GO | ||
INSERT INTO dbo.IndexInternalsOne DEFAULT VALUES | ||
GO 4 | ||
DBCC EXTENTINFO(0, IndexInternalsOne, -1) |
7 changes: 7 additions & 0 deletions
7
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-03.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-04.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--Listing 2-4. DBCC EXTENTINFO Example Three | ||
ALTER TABLE dbo.IndexInternalsOne REBUILD | ||
GO | ||
DBCC EXTENTINFO(0, IndexInternalsOne, -1) | ||
GOO |
13 changes: 13 additions & 0 deletions
13
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-05.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--Listing 2-5. DBCC EXTENTINFO Example Four | ||
CREATE TABLE dbo.IndexInternalsTwo | ||
( | ||
RowID INT IDENTITY(1,1) | ||
,FillerData CHAR(8000) | ||
) | ||
GO | ||
INSERT INTO dbo.IndexInternalsTwo | ||
VALUES ('Demo'),('Demo'),('Demo'),('Demo'),('Demo') | ||
,('Demo'),('Demo'),('Demo'),('Demo'); | ||
GO | ||
DBCC EXTENTINFO(0, IndexInternalsTwo, -1) | ||
GOO |
3 changes: 3 additions & 0 deletions
3
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-06.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--Listing 2-6. DBCC IND Syntax | ||
DBCC IND ( {'dbname' | dbid}, {'table_name' | table_object_id}, | ||
{'index_name' | index_id | -1}) |
6 changes: 6 additions & 0 deletions
6
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-07.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--Listing 2-7. DBCC IND Example One | ||
USE Chapter2Internals; | ||
GO | ||
DBCC IND (0, 'IndexInternalsOne',-1); | ||
GO | ||
DBCC IND (0, 'IndexInternalsTwo',-1); |
13 changes: 13 additions & 0 deletions
13
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-08.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--Listing 2-8. DBCC IND Example Two | ||
USE Chapter2Internals | ||
GO | ||
CREATE TABLE dbo.IndexInternalsThree | ||
( | ||
RowID INT IDENTITY(1,1) | ||
,FillerData CHAR(8000) | ||
,CONSTRAINT PK_IndexInternalsThree PRIMARY KEY CLUSTERED (RowID) | ||
) | ||
GO | ||
INSERT INTO dbo.IndexInternalsThree DEFAULT VALUES | ||
GO 4 | ||
DBCC IND (0, 'IndexInternalsThree',-1) |
3 changes: 3 additions & 0 deletions
3
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-09.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--Listing 2-9. DBCC PAGE Syntax | ||
DBCC PAGE ( { database_name | database_id | 0}, ?le_number, page_number | ||
[,print_option ={0|1|2|3} ]) |
15 changes: 15 additions & 0 deletions
15
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-10.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--Listing 2-10. DBCC IND Query for DBCC PAGE Examples | ||
USE [Chapter2Internals]; | ||
GO | ||
CREATE TABLE dbo.IndexInternalsFour | ||
( | ||
RowID int IDENTITY(1,1) NOT NULL | ||
,FillerData varchar(2000) NULL | ||
,CONSTRAINT PK_IndexInternalsFour PRIMARY KEY CLUSTERED ([RowID] ASC) | ||
); | ||
INSERT INTO dbo.IndexInternalsFour (FillerData) | ||
VALUES (REPLICATE(1,2000)),(REPLICATE(2,2000)),(REPLICATE(3,2000)) | ||
,(REPLICATE(4,2000)),(REPLICATE(5,25)); | ||
GO | ||
DBCC IND(0, 'dbo.IndexInternalsFour', -1); | ||
GOO |
3 changes: 3 additions & 0 deletions
3
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-11.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--Listing 2-11. DBCC PAGE with Page Header Only Print Option | ||
DBCC TRACEON(3604) | ||
DBCC PAGE(0,1,279,0) |
3 changes: 3 additions & 0 deletions
3
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-12.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--Listing 2-12. DBCC PAGE with Hex Rows Print Option | ||
DBCC TRACEON(3604) | ||
DBCC PAGE(0,1,279,1) |
3 changes: 3 additions & 0 deletions
3
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-13.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--Listing 2-13. DBCC PAGE with Hex Data Print Option | ||
DBCC TRACEON(3604) | ||
DBCC PAGE(0,1,279,2) |
4 changes: 4 additions & 0 deletions
4
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-14.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--Listing 2-14. DBCC PAGE with Row Data Print Option | ||
DBCC TRACEON(3604) | ||
DBCC PAGE(0,1,296,3) -- Data page | ||
DBCC PAGE(0,1,279,3) -- Index page |
15 changes: 15 additions & 0 deletions
15
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-15.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--Listing 2-15. Forwarded Record Scenario | ||
USE AdventureWorks2012 | ||
GO | ||
CREATE TABLE dbo.HeapForwardedRecords | ||
( | ||
RowId INT IDENTITY(1,1) | ||
,FillerData VARCHAR(2500) | ||
); | ||
INSERT INTO dbo.HeapForwardedRecords (FillerData) | ||
SELECT TOP 24 REPLICATE('X',2000) | ||
FROM sys.objects; | ||
DECLARE @ObjectID INT = OBJECT_ID('dbo.HeapForwardedRecords'); | ||
SELECT object_id, index_type_desc, page_count, record_count, forwarded_record_count | ||
FROM sys.dm_db_index_physical_stats (DB_ID(), @ObjectID, NULL, NULL, 'DETAILED'); | ||
GOO |
10 changes: 10 additions & 0 deletions
10
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-16.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--Listing 2-16. Script to Cause Forwarded Records | ||
USE AdventureWorks2012 | ||
GO | ||
UPDATE dbo.HeapForwardedRecords | ||
SET FillerData = REPLICATE('X',2500) | ||
WHERE RowId % 2 = 0; | ||
DECLARE @ObjectID INT = OBJECT_ID('dbo.HeapForwardedRecords'); | ||
SELECT object_id, index_type_desc, page_count, record_count, forwarded_record_count | ||
FROM sys.dm_db_index_physical_stats (DB_ID(), @ObjectID, NULL, NULL, 'DETAILED'); | ||
GO |
16 changes: 16 additions & 0 deletions
16
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-17.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--Listing 2-17. Page Split Scenario | ||
USE AdventureWorks2012 | ||
GO | ||
CREATE TABLE dbo.ClusteredPageSplits | ||
( | ||
RowId INT IDENTITY(1,1) | ||
,FillerData VARCHAR(2500) | ||
,CONSTRAINT PK_ClusteredPageSplits PRIMARY KEY CLUSTERED (RowId) | ||
); | ||
INSERT INTO dbo.ClusteredPageSplits (FillerData) | ||
SELECT TOP 24 REPLICATE('X',2000) | ||
FROM sys.objects; | ||
DECLARE @ObjectID INT = OBJECT_ID('dbo.ClusteredPageSplits'); | ||
SELECT object_id, index_type_desc, index_level, page_count, record_count | ||
FROM sys.dm_db_index_physical_stats (DB_ID(), @ObjectID, NULL, NULL, 'DETAILED'); | ||
GO |
9 changes: 9 additions & 0 deletions
9
Performance Indexing - Chapter 02/Chapter 02 - Listing 2-18.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--Listing 2-18. Script to Cause Page Splits | ||
USE AdventureWorks2012 | ||
GO | ||
UPDATE dbo.ClusteredPageSplits | ||
SET FillerData = REPLICATE('X',2500) | ||
WHERE RowId % 2 = 0; | ||
DECLARE @ObjectID INT = OBJECT_ID('dbo.ClusteredPageSplits'); | ||
SELECT object_id, index_type_desc, index_level, page_count, record_count | ||
FROM sys.dm_db_index_physical_stats (DB_ID(), @ObjectID, NULL, NULL, 'DETAILED'); |
Binary file added
BIN
+19.5 KB
Performance Indexing - Chapter 02/Performance Indexing - Chapter 02.ssms_suo
Binary file not shown.
16 changes: 16 additions & 0 deletions
16
Performance Indexing - Chapter 02/Performance Indexing - Chapter 02.ssmssln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# SQL Server Management Studio Solution File, Format Version 11.00 | ||
Project("{4F2E2C19-372F-40D8-9FA7-9D2138C6997A}") = "Performance Indexing - Chapter 02", "Performance Indexing - Chapter 02.ssmssqlproj", "{2C4687EB-DFF8-4471-92C2-2F2CAE4D567D}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Default|Default = Default|Default | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{2C4687EB-DFF8-4471-92C2-2F2CAE4D567D}.Default|Default.ActiveCfg = Default | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Oops, something went wrong.