Adding a new column in a database is more than a single command. You must consider data type, nullability, default values, indexing, and migration speed. On large tables, an ALTER TABLE can lock writes and stall requests. A careless update can cause downtime, create inconsistencies, or trigger massive replication lag.
Plan the new column with your storage engine in mind. Know how PostgreSQL, MySQL, or your chosen system handles schema changes. Check whether the operation is online or blocking. Use tools like pt-online-schema-change or native ALTER algorithms that stream changes without locking the table.
Choosing the right data type is critical. Avoid broad types when data is predictable. Define constraints to prevent corrupt entries. If the column stores timestamps, set a default to current time to avoid null rows. If indexing, remember it adds read speed but slows writes.
Backfill with care. On live systems, batch updates to reduce load. Monitor query performance during the fill. For columns that must be immediately available, design migrations in multiple steps: add the column, fill data incrementally, then apply constraints and indexes.