Generated columns can be indexed and cannot be written

A value derived from other columns is usually maintained by application code or a trigger, and both drift. A generated column is computed by the server and cannot be set, so it cannot disagree with its inputs.

ALTER TABLE orders
  ADD COLUMN total_cents INT
    GENERATED ALWAYS AS (net_cents + tax_cents) STORED,
  ADD INDEX idx_total (total_cents);

UPDATE orders SET total_cents = 0;   -- ERROR 3105

STORED writes it to disk and can be indexed; VIRTUAL computes on read and can also be indexed in 5.7, at the cost of computing during the index build. The expression must be deterministic, which rules out NOW() and any user-defined function. Adding one rebuilds the table, so it needs the same care as any other schema change on a large one.