Google
 

Kamis, 05 Juli 2007

Firebird locking

This problem is always asked by beginner. In Firebird there is one jargon that called "MGA (multi generated architecture)", this MGA can make reader not blocking writer. It means if we only select data from database to read then the others can do update the same data on that table without locked by the reader. What about if 2 user update the same of data? The last that commit data is the winner (if only update data except primary key), but if the update include updating the primary key then the second user will fail because the old primary key is invalid. There is many article that you can found in internet about the keyword MGA here. I hope this simple explanation can show you why locking in Firebird doesn't necessary. But if you want locking, then Firebird support record locking by adding the keyword "WITH LOCK" like this:
"select * from employee where id>30 with lock"

You can found a lot of explanation about that explicit locking by reading the release notes of Firebird 1.5.3 page 33

Tidak ada komentar: