A
A
Alexander Vladimirovich2018-09-13 10:38:27
symfony
Alexander Vladimirovich, 2018-09-13 10:38:27

How to perform a big insert?

Hey!
It is necessary to insert 100 million rows into the database with a
query like this

INSERT IGNORE INTO database.table (
                    `id`, 
                    `category_id` ,
                    `data`
                ) VALUES 
               (1,2,"данные"),
               (2,3,"данные2"), 
                    ... ,
               (1000000000,10000000003,"данные1000000000");

how to do it in doctrine and symfony (4)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2018-09-13
@polyanin

As you can see from a recently asked question , Doctrine does not support this kind of syntax.
Surprising here is something else.
It takes less time to "create a mysqli connection" and execute a query than writing a toaster question.
Not to mention that for a one-time insert, neither "mysqli" nor PHP is needed at all - everything is done through the mysql console.
If there is no request as such, but there is only a text file with data, then they are inserted through LOAD DATA INFILE, again without the slightest participation of Symphony, Doctrine and PHP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question