Adding a new column changes data structure and performance. In SQL, the ALTER TABLE statement creates it fast when planned right.
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP;
This works, but danger hides in the details. Large tables lock during schema changes. That can block writes and reads. Use a migration strategy that fits the size and traffic of your database.
For small datasets, a direct ALTER TABLE is fine. For huge tables, split changes into phases. Add the new column with a default value off, then backfill in controlled batches. Avoid full-table rewrites unless downtime is acceptable.
Choosing the right column type is not trivial. Use types that match the data’s precision and storage needs. TIMESTAMP vs DATETIME matters. VARCHAR(255) vs TEXT matters. Each has impact on index size, cache use, and query speed.