The table was failing. Queries ran long. Reports broke. The missing piece was simple: a new column.
Adding a new column to a database table should be clear, fast, and predictable. Yet in production systems with high traffic and strict uptime requirements, even basic schema changes can cause downtime or degraded performance. The challenge is not the syntax; it is applying the change without locking rows, blocking writes, or delaying reads.
To add a new column in SQL, the common operation is:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
In local development, this is instant. In large deployments with millions of rows, the operation may lock the table and disrupt service. For PostgreSQL, ALTER TABLE ADD COLUMN with a default value in older versions rewrites the whole table. MySQL’s behavior depends on storage engine and version. Each database’s implementation details change the risk profile.