The query finished running three seconds ago, and the logs show a single statement: ALTER TABLE tasks ADD COLUMN priority INT NOT NULL DEFAULT 0;.
A new column changes everything. It shifts the shape of the data model, alters indexes, and affects every query that touches that table. Slow queries, broken inserts, silent application bugs—they can all appear the moment a column is added without care.
When you define a new column, the first question is not type; it’s purpose. Know exactly why this column exists. Study how it will be read and written. Determine its cardinality, indexing strategy, and potential nullability before you touch production. Every column has a cost—storage, memory, I/O—spread across every row.
Schema migrations for adding new columns must be atomic and safe. In PostgreSQL, ALTER TABLE ... ADD COLUMN is fast if the column has a constant default, but large defaults or functions can lock the table. MySQL may require careful planning to avoid long locks, especially on large datasets. Use online schema change tools when downtime is not an option.