Adding a new column to a production table is simple in syntax but rarely simple in impact. Whether you’re working in PostgreSQL, MySQL, or another SQL engine, ALTER TABLE is the command. But the real work is planning it so the migration doesn’t lock rows, break indexes, or slow every request.
First, check the size of the table and the system load. On high-traffic systems, adding a column with a default value can rewrite the entire table, causing downtime. In PostgreSQL, adding a column without a default is near-instant. Populate it later in batches. In MySQL, use ALGORITHM=INPLACE when possible to reduce locking.
Review any ORM migrations before running them in production. Auto-generated schema changes can differ from the raw SQL you would write, and some tools add constraints or defaults that trigger a full table copy. Test the migration on a staging database cloned from production data to measure the actual timing and locking behavior.