Adding a new column to a database table is one of the most common modifications in production systems. Done right, it improves functionality. Done wrong, it breaks queries, slows performance, and disrupts deployments.
Start with clarity: define the name, data type, default value, and constraints. Each detail matters. A poorly named column can cause confusion across teams. The wrong data type can force casts that degrade speed or blow up integrations.
For SQL databases, the ALTER TABLE statement is your tool. In PostgreSQL:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP DEFAULT NOW();
This changes the schema instantly, but in large tables it can lock writes. Plan for minimal downtime. Use transactional DDL for small datasets. For massive tables, consider online schema change tools or migration frameworks to prevent blocking.