The query ran in seconds, but the data told you nothing new. You need another field. You need a new column.
Adding a new column to a database table seems simple, but it can destroy performance or block writes if done wrong. Schema changes shift the shape of every row. In large systems, that means touching millions—or billions—of records.
The safest way to add a new column starts with understanding the impact on storage and indexes. Define the column type with precision. Avoid defaults that force a full table rewrite unless required. In PostgreSQL, use ALTER TABLE ... ADD COLUMN for instant metadata changes when possible. In MySQL, review whether the engine supports in-place DDL to reduce lock time.
If the new column needs to be populated, load data in small batches. Avoid locking the table for the entire migration. Track row updates with a job queue or background worker. Reindex only if the new column will be part of a query path.