Adding a new column sounds simple. In production, it can break queries, slow migrations, and cause downtime if done wrong. The right approach depends on database type, table size, and traffic load. A careless command on a critical table can lock writes and block the app. Planning and execution matter.
In SQL databases like PostgreSQL or MySQL, ALTER TABLE ADD COLUMN is the common statement. On small tables, it’s instant. On large tables, it may trigger a rewrite, consuming CPU and I/O. To avoid locks, use techniques like ALGORITHM=INPLACE in MySQL or ADD COLUMN with defaults left NULL in PostgreSQL, then backfill in smaller batches.
For non-relational databases, adding a new column is often schema-less, but the cost shifts to the application layer—existing documents may need updating, and queries must handle missing values. Always review data access patterns before deployment.