Answer the question
In order to leave comments, you need to log in
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
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.
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question