Skip to content

Commit bf9bb6f

Browse files
authored
Merge pull request #612 from bluefooted/sequential-key-demo
Updating demo to use AdventureWorks2016_EXT
2 parents 6c6792c + 6a4d494 commit bf9bb6f

4 files changed

Lines changed: 16 additions & 19 deletions

File tree

samples/features/optimize-for-sequential-key/README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ To run this sample, you need the following prerequisites.
3737

3838
1. SQL Server 2019 (or higher)
3939
2. A server (physical or virtual) with multiple cores
40+
3. The [AdventureWorks2016_EXT](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2016_EXT.bak) sample database
4041

4142
[!NOTE]
4243
> This sample was designed for a server with 8 logical cores. If you run the sample on a server with more cores, you may need to increase the number of concurrent threads in order to observe the improvement.
@@ -48,21 +49,23 @@ To run this sample, you need the following prerequisites.
4849

4950
1. Copy the files from the root folder to a folder on the SQL Server.
5051

51-
2. From SQL Server Management Studio or Azure Data Studio, run the Setup.sql script.
52+
2. Download [AdventureWorks2016_EXT.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2016_EXT.bak) and restore it to your SQL Server 2019 instance.
5253

53-
3. Modify the SequentialInserts_Optimized.bat and SequentialInserts_Unoptimized.bat files and change the -S parameter to point to the server where the setup script was run. For example, `-S.\SQL2019` points to an instance named SQL2019 on the local server.
54+
3. From SQL Server Management Studio or Azure Data Studio, run the Setup.sql script.
5455

55-
4. Open the SQL2019_LatchWaits.htm file to open a Performance Monitor session in your default browser.
56+
4. Modify the SequentialInserts_Optimized.bat and SequentialInserts_Unoptimized.bat files and change the -S parameter to point to the server where the setup script was run. For example, `-S.\SQL2019` points to an instance named SQL2019 on the local server.
5657

57-
5. Right-click anywhere in the browser window to clear the existing data from the session.
58+
5. Open the SQL2019_LatchWaits.htm file to open a Performance Monitor session in your default browser.
5859

59-
6. Click the play button to start the Performance Monitor session.
60+
6. Right-click anywhere in the browser window to clear the existing data from the session.
6061

61-
7. From a Command Prompt, browse to the folder that contains the demo files and run SequentialInserts_Unoptimized.bat, then return to the Performance Monitor window. You should see a high number of Page Latch waits as well as high average wait times. Note the time it takes for the script to complete.
62+
7. Click the play button to start the Performance Monitor session.
6263

63-
8. Run the SequentialInserts_Optimized.bat script from the same Command Prompt window and again return to the Performance Monitor window. This time you should see much lower number and duration of Page Latch waits, along with higher Batch requests/sec. Note the time it takes for the script to complete, it should be significantly faster than the Unoptimized script.
64+
8. From a Command Prompt, browse to the folder that contains the demo files and run SequentialInserts_Unoptimized.bat, then return to the Performance Monitor window. You should see a high number of Page Latch waits as well as high average wait times. Note the time it takes for the script to complete.
6465

65-
9. **OPTIONAL** - Modify the `-n256` parameter in the Optimized and Unoptimized scripts to see the effect on performance. Generally, the larger the number of concurrent sessions, the greater the improvement will be with OPTIMIZE_FOR_SEQUENTIAL_KEY.
66+
9. Run the SequentialInserts_Optimized.bat script from the same Command Prompt window and again return to the Performance Monitor window. This time you should see much lower number and duration of Page Latch waits, along with higher Batch requests/sec. Note the time it takes for the script to complete, it should be significantly faster than the Unoptimized script.
67+
68+
10. **OPTIONAL** - Modify the `-n256` parameter in the Optimized and Unoptimized scripts to see the effect on performance. Generally, the larger the number of concurrent sessions, the greater the improvement will be with OPTIMIZE_FOR_SEQUENTIAL_KEY.
6669

6770

6871

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ECHO OFF
22
rd /s /q %temp%\output
3-
"ostress.exe" -E -S.\SQL2019 -dSequentialKeySampleDB -Q"EXEC usp_InsertLogRecord @Optimized = 1" -mstress -quiet -n1 -r1 | FINDSTR "Cantfindthisstring"
3+
"ostress.exe" -E -S.\SQL2019 -dAdventureWorks2016_EXT -Q"EXEC usp_InsertLogRecord @Optimized = 1" -mstress -quiet -n1 -r1 | FINDSTR "Cantfindthisstring"
44
rd /s /q %temp%\output
5-
"ostress.exe" -E -S.\SQL2019 -dSequentialKeySampleDB -Q"EXEC usp_InsertLogRecord @Optimized = 1" -mstress -quiet -n256 -r250 | FINDSTR "QEXEC Starting Creating elapsed"
5+
"ostress.exe" -E -S.\SQL2019 -dAdventureWorks2016_EXT -Q"EXEC usp_InsertLogRecord @Optimized = 1" -mstress -quiet -n256 -r250 | FINDSTR "QEXEC Starting Creating elapsed"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ECHO OFF
22
rd /s /q %temp%\output
3-
"ostress.exe" -E -S.\SQL2019 -dSequentialKeySampleDB -Q"EXEC usp_InsertLogRecord" -mstress -quiet -n1 -r1 | FINDSTR "Cantfindthisstring"
3+
"ostress.exe" -E -S.\SQL2019 -dAdventureWorks2016_EXT -Q"EXEC usp_InsertLogRecord" -mstress -quiet -n1 -r1 | FINDSTR "Cantfindthisstring"
44
rd /s /q %temp%\output
5-
"ostress.exe" -E -S.\SQL2019 -dSequentialKeySampleDB -Q"EXEC usp_InsertLogRecord" -mstress -quiet -n256 -r250 | FINDSTR "QEXEC Starting Creating elapsed"
5+
"ostress.exe" -E -S.\SQL2019 -dAdventureWorks2016_EXT -Q"EXEC usp_InsertLogRecord" -mstress -quiet -n256 -r250 | FINDSTR "QEXEC Starting Creating elapsed"

samples/features/optimize-for-sequential-key/Setup.sql

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
USE master;
2-
GO
3-
4-
CREATE DATABASE SequentialKeySampleDB;
5-
GO
6-
7-
USE SequentialKeySampleDB;
1+
USE AdventureWorks2016_EXT;
82
GO
93

104
-- Create regular table

0 commit comments

Comments
 (0)