The database table was ready, but the data model demanded more. A new column was the only way forward. You can add it in seconds, but doing it right means thinking ahead about performance, migrations, and the downstream impact on queries and APIs.
A new column changes the shape of your data. In SQL, you use ALTER TABLE to add it. In PostgreSQL, MySQL, or MariaDB, the pattern is similar:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This command works, but on large tables it can lock writes. For heavy traffic systems, use online schema changes or migration tools that allow concurrent updates. In PostgreSQL, ADD COLUMN with a default value is instantaneous if the default is constant; if not, it rewrites the table.
Indexing the new column depends on its purpose. If you plan frequent lookups or range scans, create the index right after adding the column. Avoid premature indexing if it’s for infrequent queries; each index costs write performance.