Tuesday, July 15, 2008

Transaction in MySQL

Personally, I use PostgreSQL. PostgreSQL is the most advanced open-source database. I am bravely saying that it is more advanced than MySQL is at the time of this writing. However, my department is running MySQL 5.0. I feel lucky that it is not MySQL 4.1. I have to migrate my current works stored in my desktop in postgresql to mysql. It is anticipated from the beginning, but I just didn't prepare.
The migration will not be hard, though. It is easy to convert postgres dump to mysql dump for import. I searched my favorite function, Transaction. To make transaction work, InnoDB must be used, which implies mysql should be compiled with support of InnoDB. Mostly it is true.
Here is one additional change to apply for postgres dump. Any create table statement should have something like this.

create table table_name ( ...description... ) TYPE=InnoDB;

Simple, but just wonder why InnoDB is not a default type, and who wants some table type without transaction support. Transaction on mysql is relatively new feature, on the other hand, PostgreSQL already supported long time ago. Oh well.. It is what it is. We use mysql, so be it.

No comments: