Adding a new column is one of the most common schema changes. It sounds simple, yet it can bring down production if done without care. Whether you work with PostgreSQL, MySQL, or a distributed SQL engine, the fundamentals are the same. You aim for zero downtime, consistency, and safety.
First, decide on the column name and data type. Keep naming strict and descriptive. Avoid reserved words. Pick the right type at the start—changing it later is harder than it looks.
Second, plan the migration. In large tables, ALTER TABLE ADD COLUMN can lock writes. On smaller tables, it may finish instantly. On high-traffic systems, use tools like pt-online-schema-change or gh-ost to add the new column without blocking requests. For PostgreSQL, consider ALTER TABLE ... ADD COLUMN ... DEFAULT carefully—it can rewrite the entire table unless you omit DEFAULT and backfill later in batches.