Adding a new column should be fast, safe, and predictable. Downtime is expensive. Data loss is unacceptable. The process must work in production without slowing queries or blocking writes.
A new column changes the schema, and schema changes are dangerous if done without thought. The first step is to define the column type with precision. Choose NULL or NOT NULL based on real requirements, not guesswork. Use defaults carefully—improper defaults can force a table rewrite and lock rows.
In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward, but adding a NOT NULL with a default runs a full table update. In MySQL, large tables can lock during ALTER TABLE, causing service impact. To avoid this, use online schema change tools like gh-ost or pt-online-schema-change. Plan indexes separately—do not create them in the same operation unless you understand the trade‑offs.