I have used a sample CSV file which I generated myself. There are lots of variables, your server configuration, hardware, MySQL setup and lot more. Try experimenting with different chunk (batch) sizes. PHP’s fread allows to read in chunks of strings. If you got a better option please suggest via comments section below. I have used a Regex to replace newline in the CSV file. Then a third point worth mentioning is use PHP native functions wherever possible. So everything boils down to reading chunks (batches) and multi insert. Reading line by line and iterating through a loop will slowdown the process. The above is key in speeding up the overall process.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |