Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Performance Testing Script

By Jesse McLain,

This script helps developers test the performance of a stored procedure or block of code. Although it was written specifically to assist me in comparing stored procedures, it can easily be modified for other testing purposes.

The script expects two tables, 'Seq1' and 'Seq2' to exist, and be of the structure as listed in the header comment of the script. It will test the code of interest by running it using different input sizes, multiple times, and record the performance of each run. The code it tests, as listed in the script, can be found here.

The user should modify the values of these variables:

@RunsPerInputSize - the more runs at each input size, the more consistent the results

@InputSizeIncrement - the algorithm will start at this input size and also increment by it

@TotalNumberIncrements - the total number of different input sizes to test

For example, with @RunsPerInputSize = 2, @InputSizeIncrement = 50, and @TotalNumberIncrements = 3, the testing script will run the code to be tested with the following input sizes, in this order: 50, 100, 150, 50, 100, and 150.

Written by Jesse McLain

Total article views: 8609 | Views in the last 30 days: 18
Related Articles

PowerSQL – Find OS and Memory Usage Details – Multi Server Script – No Input files

Multi Server script to find OS and Memory details.  It doesn’t require a text file as its input but ...


Unused Input Parameters

Identify all objects containing unused input parameters.


Sport Lap time Input

Inputting sport times


Script to replace 5 consecutive digits with special character

In a given input string, The script searches for 5 consecutive digits and replaces it with a special...


Parameterised Input stored procedure

Parameterised Input stored procedure

performance testing    

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones