Creating a new column should be the fastest part of changing a schema. In SQL, it’s a single statement:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
But in production systems with millions of rows, the reality is slower. Schema changes can lock tables, block writes, and bring down latency. Choosing the right method to add a new column depends on your storage engine, downtime tolerance, and migration strategy.
For small datasets or staging environments, a direct ALTER TABLE works without much risk. In larger systems, you need an online schema change. Tools like gh-ost or pt-online-schema-change create a shadow table, copy data incrementally, and then switch in the new schema with minimal blocking.
When adding a new column, define the type and default value carefully. Nullable columns are easy to add but can complicate queries if your application isn’t ready to handle NULL. Non-nullable columns require either a default or a table rewrite, so test the operation against production data volume.