The fix wasn’t an overhaul. It was one line: a new column.
Adding a new column is one of the most common schema changes in modern databases. MySQL, PostgreSQL, and SQLite all support it, but the implications vary. At small scale, ALTER TABLE ADD COLUMN is straightforward. At large scale, it can lock writes, rebuild indexes, and cascade into hours of downtime if handled poorly.
A well-planned new column starts with understanding its purpose. Is it storing raw data or a derived field? Will it be frequently queried or updated? These choices determine its data type, nullability, and whether to set a default value. Poor defaults lead to unnecessary storage bloat and slower scans.
Performance isn’t the only concern. Backward compatibility matters. Applications reading from the table must handle the presence of the new column gracefully. Deploy in steps: introduce the column, backfill data through background jobs, then roll out code that depends on it. For write-heavy tables, consider adding it in an online migration using tools like gh-ost or pg_repack.