Adding a new column sounds simple. In production, it can break pipelines, corrupt data, and trigger downtime if done without care. Whether you’re using PostgreSQL, MySQL, or a distributed SQL engine, the steps and performance implications differ. The right approach depends on your schema design, storage engine, and the volume of data in the table.
A new column can be introduced with ALTER TABLE in most SQL dialects. This is the direct path, but be aware of table locks. For large tables, this can block reads and writes, causing service interruptions. PostgreSQL now supports ALTER TABLE ... ADD COLUMN ... DEFAULT without rewriting the whole table in some versions, which reduces impact. MySQL’s ALGORITHM=INPLACE can help, but it’s not always available for every type of column change.
When adding a new column with a NOT NULL constraint, populate existing rows carefully. Migrating in two steps—first adding the column as nullable, then backfilling data, and finally adding constraints—minimizes risk. This approach also works well with rolling deployments and zero-downtime migration strategies.