A new column seems simple. Add it to a table, run the migration, commit. But the decisions behind it — type, default, nullability, indexing — carry lasting weight. Each choice shapes query performance, storage cost, and data integrity.
When adding a new column in SQL, always start by defining its purpose. Map it against application logic and data access patterns. Avoid vague column names. Choose data types that fit the smallest possible footprint without losing meaning. For integers that will never exceed a low ceiling, do not default to BIGINT. For timestamps, store in UTC without exception.
Consider nullability early. If you allow NULL, design for it in application code. If you set a default, ensure it cannot be mistaken for real data. Both paths can create silent bugs if overlooked.
Indexing a new column can improve reads but harm writes. Before adding an index, analyze query plans and execution times. Use partial indexes where only a slice of data benefits from search acceleration. Run load tests under realistic conditions.