Adding a new column sounds simple. It is not. The wrong approach locks tables, blocks writes, and stalls deployments. The right approach is fast, safe, and works in production without downtime.
First, decide the column type. Use the smallest data type possible. Smaller types mean less storage and faster queries. Match the column to its data—avoid generic text fields for values that fit in integers or booleans.
Next, plan the schema change. On large datasets, run it in phases. Start with a nullable column. Skip the default if it forces a table rewrite. Backfill data in small batches to avoid load spikes. Monitor replication if you use read replicas.
For MySQL, tools like pt-online-schema-change or gh-ost let you add columns without locking writes. For PostgreSQL, adding a nullable column is instant, but setting a default on existing rows will rewrite the table. Break it into add, backfill, then set default.