Creating a new column in a database is one of the most common schema changes in modern applications. It can be trivial or destructive depending on the scale, database engine, and access patterns. Done wrong, it locks your tables, halts writes, and sends errors to production. Done right, it ships without downtime and without risk.
When planning a new column, first define its type and purpose. Avoid guessing defaults. Set NULL only if the column is truly optional. Choose the smallest data type that fits the expected range. Test with realistic data, and confirm the column aligns with existing indexing strategies.
In relational databases like PostgreSQL and MySQL, executing ALTER TABLE ... ADD COLUMN can be instant for small tables but may lock large ones. Use online schema change tools or built-in features like ADD COLUMN ... DEFAULT in newer PostgreSQL versions for safer migrations. For MySQL, tools like gh-ost or pt-online-schema-change avoid blocking writes.