Online schema changes with MySQL

New Scheme

© KIKOO KIKOO, 123RF.com

© KIKOO KIKOO, 123RF.com

Article from Issue 147/2013
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.

As a result of such situations, admins often need to modify the schema of an exiting database. In the simple case, this task is trivial; most open source databases – including MySQL, which will be the focus of this article – include functionality for modifying existing table schemas. A relatively simple ALTER TABLE statement can be used to perform tasks such as adding columns, removing a column, changing a column's type, and so forth. This functionality is built in to MySQL, and it works fine – if your database is small.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • MySQL Online Schema Changes

    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.

  • MySQL Workbench 5.1

    A small database is easy to plan on paper, but the structure quickly becomes more complex as you add more elements. MySQL Workbench can help you keep the tables arranged.

  • MySQL 5

    We’ll show you how some new features of MySQL 5 will improve software design and boost application performance.

  • Data Management

    Open source database management systems offer greater flexibility and lower costs while avoiding vendor lock-in. Finding the right one depends on your project's needs.

  • KDE's Kexi Database

    Kexi, part of the KOffice suite, allows anyone to create, populate, and maintain a database.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News