Adding a new column changes a database in ways that go beyond schema. It shapes how queries run, how indexes behave, and how your application scales. Whether you are working with PostgreSQL, MySQL, or a distributed data store, a column is never just a field. It is a change to your contract with the data.
To add a new column, start by defining its purpose. Know if it will store nullable or non-nullable data. Know if it needs a default value. Adding a NOT NULL column with no default will lock large tables during the migration. On critical systems, this can cause timeouts and service interruptions. Use careful planning to avoid it.
In PostgreSQL, you can add a column with:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
If you must backfill data, do it in small batches. Large transactions can bloat logs and fill disk space. In MySQL, adding a new column often takes a full table rebuild unless you use ALGORITHM=INSTANT where supported. With distributed databases like CockroachDB, schema changes propagate asynchronously, so code should handle both the old and new schema during the transition.