Adding a new column to a table is simple in concept but high in impact. It changes schemas, affects performance, and requires careful control in production systems. In SQL, the ALTER TABLE statement is the standard way to add a new column:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This action modifies the table structure. Depending on the database engine, it may lock the table, trigger replication updates, or cause schema drift if migrations are unmanaged. To prevent problems, new columns should be introduced with defined types, default values, and clarity on nullability.
In PostgreSQL, adding a nullable column with no default is fast, even on large tables. Setting a default on existing rows can be expensive. MySQL may behave differently, especially with older storage engines. Always check the execution plan and database logs before running schema updates on production systems.