Adding a new column should be simple, fast, and predictable. In SQL, the ALTER TABLE statement is the standard way. A basic example:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP;
This command updates the schema and makes the column available for queries. In production, the impact depends on database type, size, and locks required. Some databases allow instant column addition for certain data types; others rewrite the entire table. Always check the documentation for your specific engine.
When choosing data types for a new column, use the smallest type that can store the required data. Smaller types reduce storage costs and improve cache performance. Define NOT NULL constraints when possible to prevent unexpected null values. Default values can ensure backward compatibility with existing rows.
Indexes on a new column improve read performance but increase write costs. Only add indexes when you know the column will be part of frequent search conditions or joins. Consider creating the index concurrently or online to avoid locking tables during high-traffic periods.