A new column in a database table is one of the fastest ways to adapt to changing requirements. It can store fresh data, fuel new features, or track performance metrics without rewriting core logic. But done wrong, it can cause downtime, break queries, and corrupt reports.
When you add a new column, think beyond the schema change. Plan for migrations, defaults, and indexing. Adding a non-null column to a production table without a default value can fail immediately. Consider whether the column needs to be indexed, and if so, measure the write performance impact before deployment.
For relational databases like PostgreSQL or MySQL, adding a new column is usually an ALTER TABLE statement. In PostgreSQL:
ALTER TABLE users ADD COLUMN last_login_at TIMESTAMP WITH TIME ZONE;
This executes in constant time for most cases but can still lock the table for moments in high-traffic systems. Schedule changes during low load, or use techniques like adding the column as nullable, backfilling data in batches, and then setting constraints.