A new column changes the shape of your data model. It adds capabilities, unlocks queries, and enables new features. But adding a new column in production is often where things break. Performance drops. Migrations time out. Users notice.
Start with the schema. Define the column type with precision. Booleans, integers, text, JSON — the choice dictates storage and query cost for years. Avoid NULL defaults unless required; explicit defaults keep behavior predictable.
When adding a new column to an existing table, use online schema changes when possible. PostgreSQL’s ADD COLUMN with a default writes to every row. For millions of rows, that locks the table and can stall everything. Instead, add the column without a default, then backfill in smaller batches. Only set the default at the application layer until the backfill is complete.
For MySQL or MariaDB, tools like pt-online-schema-change or native ALGORITHM=INPLACE options handle the load without blocking reads and writes. For SQLite in production, consider migrating to a new table structure and swapping it in, since altering large tables can be painful.