Adding a new column sounds simple. In production, it can be risky. Downtime, lock contention, broken queries, and application crashes can all happen if it’s done without planning. A database schema change is never just a schema change—it’s a contract update between your data and your code.
The safest way to add a new column starts with understanding your database engine’s behavior. In PostgreSQL, adding a nullable column without a default is fast, even on large tables. Adding a non-nullable column with a default can rewrite the entire table, holding an exclusive lock. In MySQL, older versions may block writes while adding columns, while newer versions with ALGORITHM=INSTANT can make the operation near-instant.
After the DDL step, the application must be ready to handle the new column. That means updating your ORM models or raw queries with backward compatibility in mind. Deploy code that can read and ignore the column before a later deployment that writes to it. Feature-flag the writes until you are confident in the change.