The table was full. The data had nowhere to go. You needed a new column.
Adding a new column sounds simple. One command, one change. But the real challenge is doing it without breaking production, without slowing queries, and without risking corrupt data.
In SQL, a new column alters the schema. The database must rewrite storage, update metadata, and ensure constraints stay intact. For large datasets, this can lock tables, spike CPU usage, and impact availability. Planning matters.
First, know your engine. PostgreSQL handles ALTER TABLE ADD COLUMN differently than MySQL or SQLite. Some systems allow fast metadata-only changes if defaults are not specified. Others require a full table rewrite. Review documentation for your exact version; minor differences can mean minutes or hours of downtime.
Second, define the new column carefully. Data type impacts future performance. Use integers for counters, boolean for flags, and precise varchar sizes for text fields. Avoid guessing—measure the data you'll store and choose the smallest type that fits. Smaller columns keep indexes lighter and queries faster.