The query ran, and nothing happened. You realized the table was missing a field the system now needed. The fix was simple: add a new column. But doing it right, without downtime or data loss, takes more than a quick ALTER TABLE.
Adding a new column is common in evolving databases. In production, it can be dangerous. A careless change can lock the table, block writes, or cause silent performance hits. The method you choose depends on the database engine, the table size, and whether you can tolerate locks.
In MySQL, ALTER TABLE on a large table can block reads and writes. Newer versions with ALGORITHM=INPLACE or ALGORITHM=INSTANT can reduce that risk. PostgreSQL handles adding a column with a default value differently: versions before 11 rewrote the entire table, but now certain defaults are stored in the metadata.
If the change must be online, use tools like pt-online-schema-change or gh-ost to add a new column without blocking. These tools create a shadow table, copy data in chunks, then swap tables atomically. This is slower, but it keeps the service available.