Databases: MySQL->Postgres migration, script???

Databases: MySQL->Postgres migration, script???

by Noé Ortega Quijano -
Number of replies: 3
Hi moodlers,

We have Moodle 1.6.2+ running on a server with MySQL 4.1.20 and PHP 4.3.9. Everything works fine, but we are considering to move on to Postgres. Will the performance really improve a lot or not? Is there worth on migrating?

The migration process seems to be hard and difficult, but I was wondering if there is a script or something like that to automatically make the process (Martin? Iñaki?) If it does not exists... what are the steps to do it in the best way?

I have been reading several posts in the forums but I can't find good answers to this questions yet...

Thank you very much!!! ;)
Average of ratings: -
In reply to Noé Ortega Quijano

Re: Databases: MySQL->Postgres migration, script???

by Jun Yamog -
Hi,

I am not aware of a moodle specific script to migrate across db.  You maybe able to use some of the scripts downloaded over the net.  I don't have first hand experience with them, I have migrated mostly from Oracle to PostgreSQL.

There is normally no single step to do for a migration, based from different experiences I had before.  Here are probably some issues you have to look at:

1. Can the migration be done only on the data level?  This means directly converting the data from one db to another.  No application code is involved.  The process is normally done by using the database dump of the source db, running a script to generate a database dump of the target db, then restoring the created db dump to the target db.  I think for moodle its possible to do this, given that it has a very simple data model.  But you have to look at this to make sure.

2. If it requires application level migration, meaning you will be using PHP moodle api for migration.  You will need to keep track of old "id"s and map them to the new ones created.  Given that moodle does not yet use foreign constraint you have to be careful about this, as you might not detect problems during migration and will only surface when the site is being used again.

3. What is the reason for migration?  Normally with my experience from Oracle to Postgres, the biggest reason is cost of software and having an Oracle DBA.  I think for moodle, the difference of mysql and postgresql is not big.  This is because the usage of the db even if its postgresql, is still very much mysql-like.  There is very few areas in moodle that have complex queries, joins and lots of writes.  So the benefits may not be there.  But this is just a gut feeling, and not based on benchmark numbers.  You may want to use freshly installed moodle using both db, loading with test data, and doing a benchmark.

Good luck and let us know if you make the migration.  I personally prefer postgresql over mysql.
In reply to Jun Yamog

Re: Databases: MySQL->Postgres migration, script???

by Noé Ortega Quijano -
Finally we have decided to continue with MySQL, because it is enough for the number of students we have, and it is easier.

Thank you very much for your help ;)
In reply to Jun Yamog

Re: Databases: MySQL->Postgres migration, script???

by Fabricio Silva -
Im doing a specifc script to migrate from Mysql to Postgres, i made some tests with small moodle databases, and it seems to be completely functional.

Next week we should start test the script with a huge database. In case of sucess, in a few days the script will be avaiable to all the moodle comunity.




Moodle Ufba :P