Loading CSV to MySQL table – fast…

My pet project is on its way – a subtitles website done in Laravel. So, I needed some data about the movies and found out that IMDB offers a daily dump of their database. Parts of it, surely… Anyway, it is enough for me, faster than an API, better than scraping.

So, I have made a simple script to download the files using file_get_contents, and ungz-ed (I think that is how you say it 🙂 ) the file with a script I found here: https://stackoverflow.com/questions/3293121/how-can-i-unzip-a-gz-file-with-php

I knew that importing trough Laravel’s method create would be slow… Way too slow for the amount of the data IMDB has to offer (). The first alternative was to open the file in PHP, and a “foreach” loop, but why not skip PHP as much as I can?

Continue reading →