Nirmal
Nirmal

Reputation: 9549

How to generate random data for testing database performance?

I have created a test table in MySQL and would like to insert 10 million rows with randomly generated data. How to do this random generation process? Is there any predefined method in MySQL or is there any quick query we can construct to do this job?

Thank you for any help.

Upvotes: 3

Views: 6312

Answers (4)

user1235000
user1235000

Reputation: 21

This one is as easy as:

call procedurename('DATABASE','TABLE',1000,'');  

will fill 1000 random rows.

Here is the stored procedure to generate random test data.

Upvotes: 1

Batandwa
Batandwa

Reputation: 550

Try generatedata.com which seems very customisable. You can also create an account on the website to store your configuration by donating or fork the project on GitHub and install it locally.

An alternative is databasetestdata.com. It doesn't seem as customisable generatedata.com, but does a pretty good job. You can also store and reuse your fields layouts (aka recipes).

I would recommend downloading the data as CSV and using MySQL's LOAD DATA INFILE to import the data into your database.

Upvotes: 0

Mitch Wheat
Mitch Wheat

Reputation: 300549

On MySQL forge: RandomDataGenerator:

The Random Data Generator allows the creation of tables of arbitary size containing an arbitary combination of columns, filled with random data.

Upvotes: 7

vimalg2
vimalg2

Reputation: 21

You might also like the Large Data Generator (ldg) script from Tungsten's toolbox, useful for larger datasets.

Download: http://code.google.com/p/tungsten-toolbox/downloads/list

Docs: http://code.google.com/p/tungsten-toolbox/wiki/Large_Data_generator

Upvotes: 2

Related Questions