Adding a new column sounds simple. In practice, it’s a choice that can break performance, lock writes, or trigger long-running migrations if done without care. Whether you’re working in PostgreSQL, MySQL, or another relational database, the way you add a new column decides how safe and fast the change will be.
The first step is to define the column type and constraints. If possible, avoid adding a NOT NULL column with a default value in one step on large tables—this often rewrites the entire table. Instead, add it as nullable, backfill in batches, then enforce constraints. Modern versions of PostgreSQL can add a NOT NULL with a constant default instantly, but only if certain conditions are met.
Consider indexing. A new column that drives queries may require an index, but creating that index before the column is populated can waste time and I/O. For heavy workloads, create indexes concurrently (PostgreSQL) or with ONLINE options (MySQL) to reduce downtime.