Adding a new column is more than a schema change. It impacts queries, indexes, migrations, and storage. Done wrong, it can slow your database, break your app, or cause a production outage. Done right, it becomes a seamless part of your data model.
Start by deciding what the column will hold. Choose the correct data type. Avoid unnecessary text fields where integers or enums are better. Align naming with existing conventions so future developers know its purpose without guesswork.
When adding a new column in SQL, you use ALTER TABLE. In PostgreSQL:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
Run this on a staging environment first. Check how it affects row width and performance on large tables. For high-traffic systems, consider adding columns with default values set to NULL to prevent locking during the migration.