A
A
Andrey Kvartsov2018-02-19 13:22:00
MySQL
Andrey Kvartsov, 2018-02-19 13:22:00

How to quickly add 200k rows in MySql?

Good afternoon. There is a file in the .txt format, after processing which, you need to add data to the MySql database. How to properly organize the addition so that the work goes faster and there is a minimum load on the database?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
AVKor, 2018-02-19
@AVKor

LOAD DATA LOCAL INFILE 'test.csv' INTO TABLE test;

S
Stanislav Pugachev, 2018-02-19
@Stqs

from .txt we generate .sql
in which a long
INSERT INTO MyTable ( Column1, Column2 ) VALUES
( Value1, Value2 ), ( Value1, Value2 )
and then we feed it to MySQL

A
Alexander Sisyukin, 2018-02-19
@Caarl

Find out the maximum query length In Mysql then add rows per packet based on this limit .
If you have vps or mysql built with the in file flag, then the fastest is via csv

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question