A
A
Alexis_D2018-04-23 09:09:19
PHP
Alexis_D, 2018-04-23 09:09:19

How to speed up import from excel to mysql database?

Good day. To import files into the mysql database, I use the PHPExcel library, there are 90 thousand files in the excel file. lines and when importing into the database, it takes about 35-40 minutes, how can I speed up this process?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
Lander, 2018-04-23
@usdglander

Export the excel file to CSV and import the CSV into the database via the console.
upd. If you only need PHP, you can use batch adding. This is when one INSERT lists data for several rows at once.

A
Andrey Astafiev, 2018-04-23
@Astafiev_Andrey

As I understand it, you read the excell file and insert line by line into the database?
If so, then create an array in memory and insert into the database not one line at a time, but a whole bunch at once, and things will go faster
If you want to speed up further, then at your own risk, disable the table index, triggers and links, then the insert will also be faster, but there may be pitfalls, for example, data integrity may be violated, and if the table is often accessed, then slow down for this time system will be. but just such an option is also possible, so we look for ourselves.

Z
Zhainar, 2018-04-23
@zhainar

The fastest way
5addf04670b12135275186.jpeg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question