Adding a new column should be simple. One command. One instant schema change. But in production, nothing is simple. Your database is live. Queries never stop. Users are active. And downtime is not an option.
When you add a new column to a SQL table—whether in PostgreSQL, MySQL, or any other relational database—you create more than just a field. You create a contract. The schema changes, constraints evolve, indexes may shift. You need to know what happens under the hood: how the database locks the table, how it writes the metadata, and whether rows are rewritten or left untouched.
The safest way to add a new column in PostgreSQL is with ALTER TABLE ... ADD COLUMN for small changes, but you must watch for blocking writes. In MySQL, use ALTER TABLE but consider ALGORITHM=INPLACE or ONLINE in supported versions to avoid full table rebuilds. Default values can cause performance hits—especially if they are non-null—because the database might rewrite the entire table to populate them. Nullable columns with no defaults are faster and safer.