Adding a new column to a production database should be deliberate. Done carelessly, it can lock rows, block writes, or trigger expensive table rewrites. Whether you use PostgreSQL, MySQL, or a cloud-managed service, the process starts with understanding the schema change path your engine takes. Some operations are metadata-only. Others rewrite the entire table. This difference decides if you can ship now or if you wake up to alerts.
In PostgreSQL, adding a nullable column without a default is usually instant. Adding a default value before 11.2 rewrites the table; after 11.2, it sets the default in metadata. In MySQL, ALTER TABLE often copies data into a new table, but InnoDB’s ALGORITHM=INPLACE can avoid that in certain cases. Always test in a staging environment with production-scale data. The cost of assumptions is high.
Plan your new column changes with indexes in mind. Adding an index immediately after adding a column can cause further locks or CPU spikes. If you already know you’ll query against the new column, create the index concurrently in PostgreSQL or with ONLINE in MySQL to keep tables writable. Avoid adding multiple expensive changes in a single migration; break them into smaller steps so you can roll back if needed.