Facebook open source MySQL utility
Facebook has open sourced a MySQL utility, OSC (Online Schema Change), which it uses to change server schemas on its live systems. The problem Facebook faced was that when it needed to change the structure of its MySQL databases on live systems, using ALTER TABLE statements took too long.
Facebook found an existing tool in openark kit MySQL utility collection, oak-online-alter-table, which used MySQL 5.0 triggers to speed the process of a non-blocking ALTER TABLE operation. Facebook took this BSD licensed tool, ported it to PHP and enhanced it for its needs, adding foreign key checking and optimising original table scanning by performing multiple scans of sub ranges of the primary keys.
Developer Vamsi Ponnekanti told The Register that the tool has reduced the time taken to update all their systems schemas from six months, as they could only update in off-peak hours, down to "about half a day". Like the openark kit tool it is based on, OSC is available to download under a BSD licence.