Adding a new column sounds simple, but bad design or poor execution can wreck performance and break production. The right approach starts with understanding the table’s size, its indexes, and the workloads running against it.
First, assess the impact. On small tables, a synchronous ALTER TABLE ADD COLUMN is fine. On large tables, blocking writes for minutes or hours is unacceptable. Use online schema change tools like gh-ost or pt-online-schema-change to avoid downtime.
Choose the correct data type from the start. Too wide? You waste storage and hurt cache efficiency. Too narrow? You risk data truncation and future schema changes. Consider NULL vs NOT NULL — every NULLable column adds overhead and affects index size.
Set a sensible default only when necessary. Defaults can lock rows during the update. If filling the column with computed values, batch the write operations and monitor replication lag.