The query runs in under a second, but the numbers don’t look right. A missing column in the schema is the cause. You need a new column, and you need it now.
Adding a new column sounds simple. It can be simple — but it can also take your system down if done without care. A schema change touches live data. It affects read queries, write operations, indexes, migrations, and even application logic.
Start by defining the exact need. Is the new column for storing derived data, a flag, or something that drives application behavior? Decide on the data type with precision. Avoid defaults that will bloat storage or slow queries.
In PostgreSQL, ALTER TABLE table_name ADD COLUMN column_name type; is instant for metadata, but not for large tables if a default is set. In MySQL, the process may lock the table depending on the storage engine and version. Plan migrations so they are fast and safe. In high-load environments, use online schema change tools like gh-ost or pt-online-schema-change to avoid blocking writes.