The query runs fast, but the table is missing the one thing it needs: a new column.
Adding a new column is one of the most common schema changes in software projects. It is simple in theory, but a mistake can lock rows, break integrations, or corrupt data. To get it right, you need a clean plan and precise execution.
First, decide the column name and data type. Use clear, consistent naming that matches your existing schema style. Avoid overly generic names that invite misuse. Next, define constraints and defaults. If the column must be NOT NULL, choose a safe default value before applying the migration.
Run the change in a staging environment before touching production. This confirms that indexes, triggers, and downstream services still work. For large datasets, consider online schema changes to prevent downtime. Tools like ALTER TABLE ... ADD COLUMN in MySQL or Postgres work well for small, quick changes but can take locks that slow traffic.