Adding a new column should be fast, safe, and clear. In SQL, the syntax is simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This creates a column without locking your table for long in most modern systems. But the details matter. In PostgreSQL, adding a nullable column with no default is virtually instant. Adding a column with a default value to billions of rows can lock writes and slow everything to a crawl. MySQL behaves differently depending on storage engine and version.
When you add a new column, plan for type, nullability, defaults, and indexing. Indexing immediately after creation can double your migration time. Instead, roll out in stages: add the column, backfill in batches, then create the index. This reduces downtime and risk.
Migrations in production databases require discipline. Always test on a staging system with realistic data volumes. Measure how long the column addition takes. Monitor replication lag if using replicas, because schema changes can stress the replication stream.