Adding a new column in a database should be fast, safe, and predictable. In SQL, it starts with ALTER TABLE. You name the table, define the column, set the type, and decide if it can be null. That’s the core. But doing it in production at scale is more than just syntax. You have to think about locks, replication lag, and default values.
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
Simple. But on a large dataset, that command can lock writes for seconds or minutes. Use an online schema change tool to avoid downtime. Plan your migration so you know its effect on indexes, storage, and query patterns. For some column types, adding with a default value is instant in modern PostgreSQL, but not in MySQL without special flags. Always benchmark.
A new column changes more than the schema. Application code must read and write it. APIs should expose it only when ready. Rolling it out in phases—schema change, code update, backfill—reduces risk. Track query plans before and after to catch performance changes.