Adding a new column is one of the most common schema changes in any database. It happens when logic changes, when fields need more detail, or when an application feature demands it. Done carelessly, it can lock tables, slow queries, or force downtime. Done right, it is invisible to the end user.
First, define the column name and data type. Choose a type that matches both storage needs and performance goals. Avoid over-allocating size; wide columns cost memory, CPU, and I/O. Use NULL defaults if the data is optional, but be aware that NOT NULL constraints may require backfilling existing rows.
Second, execute the change in a way that avoids blocking writes. Many relational databases support online DDL with syntax like:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP NULL;
In PostgreSQL and MySQL, adding a nullable column without a default is fast, even on large tables. Adding a column with a default requires a full table rewrite unless the engine supports instantaneous defaults. Test schema changes on a replica and review execution plans before touching production.