Adding a new column looks simple, but in a live system it’s a risk. Schema changes can lock tables, block queries, and cascade failures across dependent services. The safe path is clear: plan, test, and deploy with precision.
First, assess the table size and query volume. On small tables, ALTER TABLE ADD COLUMN completes quickly. On large or heavily used tables, that same command can block reads and writes for minutes or hours. Always check the execution plan and watch for full table rewrites.
Use online schema change tools when possible. PostgreSQL supports ADD COLUMN with a default of NULL instantly. Adding a NOT NULL constraint or a default value for every row will rewrite the table—avoid this on hot paths without partitioning, shadow tables, or phased backfills. MySQL and MariaDB have ALGORITHM=INPLACE or ALGORITHM=INSTANT modes; know which your version supports.