Adding a new column is one of the most common schema changes in a database. It sounds simple, but it can cause downtime, data inconsistencies, and slow queries if done without care. Whether in PostgreSQL, MySQL, or distributed systems like CockroachDB, you must plan for how the new column will fit into both the data model and the application code.
The first step is deciding the column type. For integers, booleans, and small text fields, the cost of adding a new column is usually minor. For large text blobs, JSON, or arrays, the storage and read impact can grow quickly. Review constraints, indexes, and default values before adding the column. In many databases, adding a column with a default and NOT NULL will rewrite the table, blocking reads and writes.
To add a new column without downtime, use online schema change tools or database-specific online DDL features. In PostgreSQL, adding a nullable column without a default is fast, because it only updates metadata. Populate the column in batches to avoid locking. In MySQL, use ALGORITHM=INPLACE or INSTANT when available. For migrations in production, use migration frameworks that allow stepwise deployment: deploy the schema change, deploy code that writes to both old and new paths, backfill data, then cut over reads.