Adding a new column to a production table sounds simple. It isn’t. The wrong approach blocks queries, locks writes, and burns uptime. The right approach keeps your system moving while the schema changes beneath it.
First, define the purpose of the new column with precision. Decide its data type, nullability, default values, and indexing before touching the schema. Every detail matters because altering a large table can cascade into performance issues if planned poorly.
Use an online schema change method when possible. In MySQL, tools like pt-online-schema-change or gh-ost migrate data without locking the table. In PostgreSQL, adding a column without a default value is generally safe, but setting a default on a large table should be staged to prevent long locks. For distributed databases, ensure schema changes replicate safely across nodes without causing downtime.