Adding a new column to a table should be fast, safe, and predictable. In real systems, it can trigger downtime, slow queries, or failed deployments if done without care. The key is understanding both the database engine and the application code paths that depend on it.
First, determine if the new column will have a default value or allow NULL. Adding a column with a constant default can cause the database to rewrite the entire table. On large datasets, this blocks writes and crushes performance. Use NULL plus an application-level default to avoid that rewrite when possible.
Second, check for related indexes or constraints. If you add a column and immediately index it, plan your steps: column creation, backfill if needed, then index creation. Build indexes concurrently or online where supported to avoid blocking queries.
Third, ensure application code migrations are in sync with schema changes. Ship code that can handle both the old and new schema before you run the migration. Deploy the DB change after the new code is live. This ensures zero-downtime deploys.