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.
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.
You might also like the Large Data Generator (ldg) script from Tungsten's toolbox, useful for larger datasets.
This one is as easy as:
will fill 1000 random rows.
Here is the stored procedure to generate random test data.
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.