A new column changes your database structure. If you run it wrong, you risk downtime, locked tables, or slow queries that ripple through production. For small datasets, it might be as easy as an ALTER TABLE statement. For large, high-traffic databases, it’s not that simple.
The most common approach is a direct alter:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
Fast to write, fast to run—until your table holds millions of rows. Then it can block reads and writes. Your options shift. You can create a new table with the column, copy data in chunks, and swap it in. You can add the column as nullable, then backfill asynchronously. You can use an online schema change tool like pt-online-schema-change, gh-ost, or native database features (e.g., ADD COLUMN with ALGORITHM=INSTANT in MySQL 8).
When you add a new column to a critical system, you also need to think about indexing, migrations under load, and application-level feature flags. Changing code before the field exists will fail. Changing the schema before the code is ready will also fail. Deploy in sequence. Stage changes in a way that ensures your services and your database agree at every step.