M
M
Mikha Pankratov2016-06-15 17:28:17
MySQL
Mikha Pankratov, 2016-06-15 17:28:17

How to create a lot of data for testing?

Good evening, at
once about the main thing...
I have 3 connected tables where there are 30 lines of the valid data.
I need to multiply this related data to eg 500,000 rows for testing purposes.
I do a greedy load and then insert insert - it goes out for 17 hours) Tell me, maybe there is a faster way.
Thank you.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mikha Pankratov, 2016-07-05
@frmax

It's best to use branchInsert and populate the database in an instant)

U
un1t, 2016-06-15
@un1t

https://dev.mysql.com/doc/refman/5.5/en/optimizing...

I
IceJOKER, 2016-06-15
@IceJOKER

Disable keys before multiple inserts.
After you turn it on.
dev.mysql.com/doc/refman/5.7/en/alter-table.html
And for data generation I recommend Faker

M
Maxim Fedorov, 2016-06-15
@qonand

use the points described in the article, the link to which was given by un1t,
but I would like to add that you can move the data generation outside of php to the database level, this will also save time due to the lack of data exchange between php and the database. For example, move the generation to a stored procedure:

CREATE PROCEDURE `make_data`()
BEGIN
DECLARE i INT DEFAULT 1;
WHILE i < 500000 DO
    <тут INSERT запрос>
    SET i = i + 1;
END WHILE;  
END

and, accordingly, call it in the same phpMyAdmin:
well, do not forget about the multiple insert, it will also give a gain in time
PS in my opinion it is better to use ready-made utilities for generating data

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question