The query returned too many rows. You need a new column.
A new column changes the shape of your data. In SQL, adding a new column means altering the table definition without losing existing records. In PostgreSQL, MySQL, or SQLite, the syntax is simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
The database updates its schema on disk. Current rows get NULL in the new column unless you set a default value:
ALTER TABLE users ADD COLUMN is_active BOOLEAN DEFAULT true;
When designing a new column, define data types with intent. Use INTEGER for counts, TEXT for unstructured strings, and constrained types like ENUM if the set of values will remain fixed. Avoid wide VARCHAR limits unless you have a reason; they add overhead at scale. Indexing a new column is not automatic. If it will be part of WHERE clauses, create an index:
CREATE INDEX idx_users_last_login ON users(last_login);
In production environments, adding a large indexed column on high-traffic tables can lock writes or slow queries. Use migrations in off-peak hours or with tools that allow online schema changes. For analytics datasets, a new column may increase storage by gigabytes and require repartitioning. Always measure before deployment.
Treat a new column as both a structural and operational change. It shapes queries, indexes, and downstream pipelines. Track the schema version in version control so the entire stack stays in sync.
Test every migration on a staging copy with production-like data. Confirm that the new column populates as intended, that queries using it run within performance targets, and that dependent services consume it without error.
When executed with precision, adding a new column extends your data model without breaking stability.
See it live in minutes with real migrations and instant schema previews at hoop.dev.