Adding a new column in a production database is routine, but it isn’t trivial. The choice of how you add it depends on table size, query patterns, and downtime tolerance. In small tables, an ALTER TABLE ... ADD COLUMN is quick. On large, high-traffic tables, the same command can block writes or lock the table, stalling the application.
The safest first step is to assess impact. Check schema dependencies, triggers, and indexes. Confirm if the new column should have a default value and whether it can be nullable. Adding a nullable column with no default is usually fast in Postgres and MySQL, because it only updates metadata. Setting a non-null default can rewrite the entire table, which can cause downtime.
To avoid blocking operations, consider online schema change tools like pg_online_schema_change, gh-ost, or pt-online-schema-change. They create a shadow table with the new column, replay changes, and swap it with the original table at the end. This approach keeps queries running while the schema changes in the background.