Adding a new column is one of the most common operations in database work, but it can also be one of the riskiest if done without care. The schema change touches production data, migrations, and application logic. A poorly executed change can lock rows, stall queries, or shut down services.
Start with a clear definition of the column. Decide on data type, nullability, default value, and indexing strategy. Every choice has a performance cost. A boolean flag behaves differently from a text field. A NOT NULL integer with a default can backfill instantly in some engines, while a large text field may force a full table rewrite.
Plan the migration steps. In PostgreSQL, ALTER TABLE ADD COLUMN is fast for metadata-only additions with no default. In MySQL, online DDL can avoid downtime but needs proper configuration. For high-traffic tables, consider adding the column as nullable first, backfilling in small batches, then applying constraints in a second migration.