Adding a new column is routine, but it becomes critical when working with large datasets, strict uptime requirements, or continuous deployment workflows. The moment you alter a table, you risk locks, degraded performance, and broken queries. Planning and execution matter.
Choose the right migration strategy. For smaller tables, a simple ALTER TABLE ADD COLUMN works. For tables with millions of rows, use an online schema change tool like pt-online-schema-change or gh-ost. These tools run migrations without blocking reads and writes. Test the procedure on staging with production-like data before running it live.
Set defaults carefully. A NOT NULL column with no default will fail unless every row gets updated during creation. Use NULL if flexibility is required, or assign a safe default that matches business logic. Avoid heavy transformations inside the migration; handle them with a separate batched update.