Fill database tables with a large amount of test data

后端 未结 7 1414
长发绾君心
长发绾君心 2020-12-07 09:18

I need to load a table with a large amount of test data. This is to be used for testing performance and scaling.

How can I easily create 100,000 rows of random/junk

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 09:50

    I really like the mysql_random_data_loader utility from Percona, you can find more details about it here.

    mysql_random_data_loader is a utility that connects to the mysql database and fills the specified table with random data. If foreign keys are present in the table, they will also be correctly filled.

    This utility has a cool feature, the speed of data generation can be limited.

    For example, to generate 30,000 records, in the sakila.film_actor table with a speed of 500 records per second, you need the following command

    mysql_random_data_load sakila film_actor 30000 --host=127.0.0.1 --port=3306 --user=my_user --password=my_password --qps=500 --bulk-size=1
    

    I have successfully used this tool to simulate a workload in a test environment by running this utility on multiple threads at different speeds for different tables.

提交回复
热议问题