Adding a new column should be simple. In practice, it can be the bottleneck. The wrong approach locks your table, delays writes, or worse—drops performance under load. The right approach adds the column fast, without blocking queries or risking downtime.
A new column in SQL starts with ALTER TABLE. On small datasets, it’s instant. On production-scale datasets, the database may rewrite the entire table. This can take minutes or hours, depending on engine, indexes, and storage layout. Modern systems like PostgreSQL, MySQL, and MariaDB offer optimizations, but the defaults can still surprise you.
For PostgreSQL, adding a new column with a default value triggers a full table rewrite. If you only specify the column and its type, the operation is metadata-only and fast. You can backfill values later in small batches. MySQL 8.0 supports instant column addition for some column types and positions, but moving them or adding in the middle of the schema can still be expensive.