The query was fast. The result was clean. But the table was missing what you needed most: a new column.
Adding a new column should be simple. In reality, it is where schema changes meet production risk. The decision to alter a table affects query plans, index usage, migration time, and data integrity. A poorly timed schema change can stall writes, lock rows, or cause replication lag.
A new column in SQL is not just syntax. It is storage allocation, data type choice, and nullability rules. For large datasets, the operation can trigger table rewrites. For frequently accessed tables, it can degrade performance during the change. Choosing between ALTER TABLE ADD COLUMN and creating a shadow table with backfill depends on workload size and uptime requirements.
Databases like PostgreSQL, MySQL, and MariaDB handle ADD COLUMN differently. PostgreSQL can add certain columns instantly when using defaults set to NULL. MySQL may lock the table depending on the version and storage engine. Cloud-managed databases have their own constraints, sometimes blocking DDL during peak usage.