Adding a new column sounds simple, but the wrong approach can block writes, lock reads, or corrupt data. In relational databases like PostgreSQL, MySQL, or MariaDB, the ALTER TABLE command is the starting point. Used blindly, it can cause downtime. The goal is zero-impact schema changes.
First, check table size. Large row counts require strategies beyond a direct ALTER TABLE ADD COLUMN. For massive tables, use an online schema change tool like pt-online-schema-change or pgonlinechange. These copy data into a new structure in the background, switching over seamlessly.
Second, define column defaults carefully. In PostgreSQL, adding a column with a default rewrites the entire table unless you add it without a default first, then set defaults in a second step. MySQL can add some columns instantly, but large tables may still cause replication lag without precautions.