Adding a new column to a production database is easy to describe but brutal to get wrong. The change seems small. It is not. Schema evolution touches indexes, migrations, lock times, and data integrity. If the new column is required, you must consider default values and backfilling strategies. If it’s optional, you still face null handling and downstream code impact.
In SQL, the ALTER TABLE statement is the core tool. For example:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP NULL;
This runs fast on small tables. Large datasets need more care. Online schema changes can keep your application responsive, but the wrong approach can block writes for minutes or hours. For PostgreSQL, tools like pg_repack or built-in features such as ALTER TABLE ... ADD COLUMN with a constant default can help. For MySQL, gh-ost or pt-online-schema-change avoid full table locks by streaming changes in the background.