Adding a new column sounds simple. In production, it is not. Schema changes can lock writes, block reads, and trigger downtime. The wrong ALTER TABLE command can stall a system at scale. The right approach is deliberate, tested, and safe.
First, confirm why the new column exists. Every column should have a clear purpose. Avoid speculative fields that complicate your model. Define the type exactly. Use the smallest data type that fits the intended range. Decide if it can be NULL. Set sensible defaults where possible to avoid unexpected behavior.
For small datasets, adding a column is a single statement:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP DEFAULT NOW();
For large datasets, use an online schema change method. PostgreSQL has ADD COLUMN operations that are metadata-only if the column is nullable and without defaults. MySQL can use tools like pt-online-schema-change. Always measure before and after to ensure no regression.