Adding a new column to a database is simple in syntax, but complex in impact. It changes storage, queries, and how your code understands its data. Speed and safety depend on choosing the right approach.
Plan the schema change before you touch the database. Confirm the column name, type, default values, and nullability. Verify how existing queries will react. If the data is large, consider a phased rollout with nulls allowed until writes are complete.
Run changes in a migration tool or versioned schema system. Use transactional DDL if your database supports it. On massive tables, prefer non-blocking operations. In MySQL, that means ALGORITHM=INPLACE when possible. In PostgreSQL, adding nullable columns is fast, but adding with a default can lock the table—so split those steps.