When you add a new column to a database table, you are making a structural change. In SQL, the ALTER TABLE command is the standard way to do it:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This seems straightforward, but the impact can be complex. A new column changes storage size, index performance, and query execution paths. It can trigger table rewrites depending on the database engine.
Before adding the column, confirm its data type, default value, and nullability. The wrong type can cause implicit conversions that slow queries. A default value can lock the table during update, depending on database behavior. Adding a NOT NULL column to a large table without a default may fail or require an expensive migration path.
Indexes for the new column require careful thought. They can speed reads but slow writes. Understand your workload before creating them. Adding an index without analyzing query patterns can hurt overall performance.