Adding a new column to a production database is one of the simplest changes in theory and one of the easiest ways to cause downtime in practice. It shapes how your data is stored, queried, and scaled. Done right, it feels invisible. Done wrong, it creates locking issues, index rebuilds, and hours of rollback.
Start with the database engine’s DDL syntax. For PostgreSQL:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP WITH TIME ZONE;
This is straightforward. But for large tables, every added new column can force a rewrite of data blocks. In MySQL, using ALTER TABLE without ONLINE or INPLACE options will lock writes. In PostgreSQL, adding a nullable column with a default value before version 11 will rewrite the entire table. Versions after 11 store the default in the metadata and apply it lazily. That change alone can turn a migration from minutes to milliseconds.
Choose the column type carefully. An integer or text field? Time zone aware timestamps? JSONB for flexible schemas? These decisions alter query plans and index strategies. Adding a new column is also the moment to think about nullability. Allowing NULL can speed migrations, but it shifts complexity to the application layer.