SQL Clone
SQLServerCentral is supported by Redgate
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)

Generate Large Amount of Data For Performance Testing

By Suresh Kumar,

While taking my training classes for SQL Server, students ask many times if they can get some large sample tables to do perfroamce tuning. So I thought of writing a script to generate the sample data as per my need. To use this script to generate data, you need to have AdventureWorks2012 DB on that machine. If you don't have it, you may download it from :


Then you may run the script to generate sample data in table AllCustomerOrders. You just need to specify how many rows you want to generate. e.g. to generate 100 records, I have specified it like this:

Declare @RowsRequired Bigint =100

So instead of 100, you may specify a big number.

I tried a sample run on my Core i5 4 GB RAM laptop And below are the results:
Number Of records Size TimeTaken(hh:mm:ss)
5 million - 500MB 00:04:00
10 million 990 MB 00:09:00
90 million     8.9 GB 01:49:00
If any of you need explanation how the code is written, Let me know and I will be happy to assist.

Total article views: 462 | Views in the last 30 days: 6
Related Articles

AdventureWorks2016CTP3 - JSON Sample scripts

Geting the JSON Sample Scripts to run


A Standard Database Security Script Generator

A script generator for standard security compliance.


Generate Insert script

Generate Insert script


Generate Script File Name

Generate Script File Name


Create Sample Data Script

in this scripts there are two methods of creating sample data for a gambling application. i have us...