The query runs, but the schema has changed. You need a new column.
Adding a new column sounds simple, but mistakes here can slow queries, lock tables, or break downstream systems. Getting it right means thinking about schema design, migration safety, and operational impact before you type ALTER TABLE.
First, define the purpose and type. Use the smallest data type that meets the need. Avoid nullable columns unless you have a clear default strategy. Index only when you have proved the query will benefit—every index has a write cost.
Plan the migration. In large datasets, online migrations prevent downtime. Use tools like pt-online-schema-change or native database features that allow concurrent changes. Test in staging with production-like data. Measure the duration and watch for locks.