Adding a new column is one of the most common, yet most critical operations in database management. It changes the shape of your data. It alters queries, indexes, constraints, and sometimes the uptime itself. Done wrong, it locks rows, stalls writes, and burns through production hours. Done right, it’s invisible.
First, decide the type. Match the column type to real-world data. Use NOT NULL only if you can backfill immediately. If you need defaults, set them at creation to avoid future drift. Keep the schema change small whenever possible.
Second, pick your execution method. In Postgres, ALTER TABLE ADD COLUMN is straightforward but can lock for metadata changes. MySQL can block depending on engine and size. For large datasets, use online schema change tools or shadow tables that let you write the new column without disrupting reads.