Adding a new column is simple in theory. In practice, it can break production if done carelessly. Schema changes affect queries, indexes, APIs, and the deployment pipeline. The stakes rise with scale, concurrency, and uptime requirements.
To add a new column in SQL, the core command is straightforward:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This tells the database to modify the table structure in place. But decisions made here matter. Use precise column types. Avoid nullable defaults unless required. On large datasets, a blocking ALTER TABLE can lock writes and slow reads. For high-traffic systems, prefer migrations with added columns that start empty, backfill in batches, and then apply constraints later.
In PostgreSQL, ALTER TABLE ... ADD COLUMN is fast for empty defaults but can still cause catalog locks. In MySQL, adding columns to InnoDB tables may require a table rebuild, depending on version and configuration. Plan the migration window or use online DDL to minimize downtime.