Online schema changes with MySQL

New Scheme

Author(s):

Making online schema changes to your database can be tricky, but the right tools can help. We show how to change even the largest tables in an orderly and efficient manner.

From your smartphone to your banking institution, relational databases are everywhere. They store many kinds of data for us – and they store it in a specific, well-defined format. Unlike many of their newer “NoSQL” brethren, relational databases have a fixed schema – they don’t accept arbitrary data. In theory, a smart designer will make entirely correct schema choices, which will then be put into production with no changes or alterations needed, because everything was perfect in the first place.

In practice, though, relational databases often go through many changes. For example, it is often found that mistakes were made in the initial schema. These mistakes need to be corrected and, at times, these corrections do not happen until long after the system is deployed. Other times, business needs change; even if the database was designed correctly in the beginning, it is often impossible to predict how a system will be used in the future.