The database stopped. All eyes were on the schema. A new column had to land fast, without breaking the system in production.
Adding a new column seems simple until it runs on millions of rows, with live traffic hitting every table. The wrong move locks queries, stalls writes, and triggers cascading failures. The right move makes it invisible to the end user while giving you the space to store new data instantly.
Start by defining the column with an explicit type and default value. Avoid NULL unless it’s intentional. In most relational databases, adding a column with a default non-null value rewrites the whole table. This creates heavy I/O and can block transactions. Use a lightweight migration if your database supports it, deferring updates to background tasks.
For PostgreSQL, adding a column with a NULL default is fast. Populate it later in small batches. For MySQL, check the storage engine. InnoDB handles new columns differently than MyISAM, but both still face locking risks under full table rewrites. Test on staging with real data volumes before touching production.