Adding a new column sounds simple, but every choice here has weight. Schema changes reach deep into the heart of a system. The name, type, nullability, defaults—each decision defines how the new column will live alongside the old data and the incoming stream.
In SQL, you can create a new column with an ALTER TABLE statement:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP;
This is the moment the column exists, but it may carry no data. Backfilling is next. Choosing between a quick default value or a careful migration script can determine if the database locks, if queries slow, or if transactions block. For large datasets, online migrations or chunked updates prevent downtime.
In production systems, a new column is more than storage. It can change how indexes work, how caches behave, and how joins perform. Index only if queries need it. Drop temp indexes after backfills to save space and speed up writes.