Adding a new column to a database table changes more than schema. It affects queries, indexes, migrations, and the performance profile of your system. The right approach depends on the database engine, the size of the table, and the uptime requirements.
In PostgreSQL, ALTER TABLE ADD COLUMN runs fast for most cases because it stores default values in metadata when possible. But adding a NOT NULL column with a non-constant default forces a table rewrite. That can lock writes and slow reads. On massive tables, you may need to add the column as nullable first, backfill in batches, then enforce constraints.
In MySQL, adding a column can trigger a table copy if the storage engine can’t optimize the operation. This makes online DDL features like ALGORITHM=INPLACE or INSTANT important. Always check your MySQL version, as support for instant column addition is newer and limited to certain column types.
Indexes change the cost. Adding a column is simple, but adding it with an index at the same time can impact operation time exponentially. For large-scale systems, separate the steps: