Adding a new column sounds simple. In practice, it can be dangerous. Schema changes touch production. They can lock tables, break queries, and slow requests. If you do it without planning, you risk downtime.
The safest way to add a new column starts with understanding your database engine. In PostgreSQL, adding a nullable column is fast, but adding a column with a default can write every row. In MySQL, large tables with blocking writes can freeze the app during the change. Always check documentation, test the migration on a copy of real data, and measure the execution time.
Use migrations through version control. Write a change script that defines the new column, its type, and constraints. For example:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP NULL;
Add indexes only when needed. Extra indexes speed queries but slow inserts. If the new column will store large data, consider normalization. Storing blobs or large text inline can inflate the row size and impact I/O.