The query ran fast. The answer came back slow. You scanned the table and saw the gap: you needed a new column.
Adding a new column may sound routine, but the details decide whether you keep speed or lose it. In most relational databases, you can modify the schema with ALTER TABLE and a ADD COLUMN statement. This works in PostgreSQL, MySQL, and most SQL engines. But the surface simplicity hides the real choices that define performance, maintainability, and uptime.
First, define the data type with precision. Use INTEGER when you mean integers, use TEXT only when variable-length strings are truly required. Every extra byte in a row slows reads and writes.
Second, choose the right default values. Setting a default avoids NULL checks in queries, but adding defaults to large tables can lock writes during migration. In PostgreSQL, adding a column with a constant default will rewrite the entire table unless you use the newer syntax that stores defaults in metadata.