Adding a new column is one of the most common schema changes in production databases. It sounds small, but the wrong move can lock tables, slow queries, or break deployments. The right approach makes the change instant and safe, even under high load.
First, define the column’s purpose. Decide its name, data type, and whether it accepts NULL values. Plan ahead for indexing if queries will filter or sort on this field. Avoid premature indexing that can increase write latency.
For SQL databases like PostgreSQL or MySQL, a simple ALTER TABLE ... ADD COLUMN works for many cases, but at scale, this can block reads or writes while the change applies. Use tools like pt-online-schema-change or PostgreSQL’s ADD COLUMN with default values applied afterward to prevent long locks. In distributed databases, check replication lag before adding a new column.