Adding a new column to a database table is one of the most common structural changes in product development. Done right, it’s fast, safe, and predictable. Done wrong, it causes downtime, locks tables, or corrupts data. The difference is knowing the mechanics and planning the migration.
First, confirm the purpose of the new column. Define its name, data type, default value, and nullability. Every choice changes how the database engine allocates storage and updates indexes. For example, adding a nullable column without a default is instant in many systems. Adding with a default non-null value may rewrite the entire table.
Second, check the size of your dataset and the database engine’s behavior. On small tables, ALTER TABLE ... ADD COLUMN may be fine. On large tables, you may need an online schema change tool like gh-ost or pt-online-schema-change to avoid locking. These tools create a copy of the table with the new column, migrate rows in small batches, and swap the tables in one atomic step.