Adding a new column changes the schema. It extends the table’s structure. It gives your data room to grow without breaking existing queries. This operation can be minor or critical, depending on timing, constraints, and the volume of data.
Use ALTER TABLE to define the new column. Choose the data type with care. Every choice affects performance, storage, and maintainability. For example:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP;
Always review default values. If the column is non-nullable, decide how existing rows get populated. This can be handled with a default value or by running an update immediately after creation.
Indexing the new column improves query speed, but adds write overhead. Avoid unnecessary indexes on fields with low selectivity. Consider composite indexes when the new column will be queried alongside others.