Adding a new column sounds simple, but in production systems it can be a high‑risk change. Schema alterations can lock tables, slow queries, or even cause outages. The right way to add a column depends on the database, the size of the table, and the traffic load.
In SQL databases like PostgreSQL or MySQL, ALTER TABLE ADD COLUMN is the basic command. On small datasets, it runs instantly. On large, high‑traffic tables, it can block reads and writes. Many teams use rolling migrations or tools like pt-online-schema-change to add columns without downtime.
Choosing column type and default values matters. Adding a column with a default can rewrite the entire table on some engines. For large tables, adding the column as nullable first and then backfilling in batches can avoid long locks.