Adding a column to an existing database table is simple in theory, but dangerous in production. Do it wrong and you lock queries, crash services, or corrupt data. The right approach depends on your stack, storage engine, and traffic patterns.
Start with a clear schema change plan. In SQL, the basic syntax looks like:
ALTER TABLE users ADD COLUMN is_active BOOLEAN DEFAULT true;
On small datasets this runs instantly. On large, high-traffic tables, the lock time can block requests. For MySQL, use ALTER TABLE ... ALGORITHM=INPLACE when possible, or add the column without defaults, then backfill in batches. For PostgreSQL, adding a column without a default is fast. If you need a default, set it after creation to avoid a full table rewrite.
Always test migrations in a staging environment. Snapshot the prod data, apply the migration, run benchmarks, and check indexes. Monitor replication lag if you run read replicas. Apply write throttling when needed.