Databases: Database Migration Takes too Long

Databases: Database Migration Takes too Long

by Robert Saari -
Number of replies: 3

We're upgrading from Moodle 1.5.2 to 1.7.x, then to 1.8.x.  The upgrade to 1.7 was successful (finally), but with more than 1.5 million total rows in the database, migrating the database to utf8 is taking waaay too long.  The script has been running for ~90 minutes now, and it says it will end in 3 hrs. and 6 mins.  Unfortunately, this estimate continues to increase. 

After doing some digging, I discovered I'm not the only one to encounter this, with some reporting 3 days to complete the migration.  What's really disturbing is the fact that, as I write this, it's converting a Long Blob field that has no data whatsoever in a table with 340,000 rows .  Ouch!

Is there a more efficient way to do this? 

The estimated completion time has risen another 13 minutes in the time it took me to write this....

Average of ratings: -
In reply to Robert Saari

Re: Databases: Database Migration Takes too Long

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
I was pretty confident that I had little to no multi-language data that would be adversely impacted if the conversion was not 100% so I cheated by using phpmyadmin to convert all of my tables to utf8. It was far more efficient but less reliable than stepping through all of the records in each table. Peace - Anthony
In reply to Robert Saari

Re: Databases: Database Migration Takes too Long

by Samuli Karevaara -
There is another way (http://docs.moodle.org/en/Alternative_migration_process), but it requires some administrative knowledge. If the case is "a couple of hours", then you might be better off by just waiting sad
In reply to Samuli Karevaara

Re: Databases: Database Migration Takes too Long

by Paolo Oprandi -
The problem with this method is that it assumes that you are exporting from mysql 4. If you are exporting from mysql 5 it doesn't work.