An expression in a WHERE clause makes an index unusable, and a generated column moves the expression into something indexable.
-- no index can serve this
WHERE JSON_UNQUOTE(JSON_EXTRACT(meta, '$.sku')) = 'ABC-1'
ALTER TABLE products
ADD COLUMN sku VARCHAR(32)
GENERATED ALWAYS AS (meta->>'$.sku') STORED,
ADD INDEX idx_sku (sku);
-- and the optimiser now rewrites the original query to
-- use the column, without the application changing.
The automatic substitution is the good part — an existing query using the expression starts using the index without an application change, provided the expression matches exactly. STORED costs disk and is required for an index on some versions; VIRTUAL computes on read and can still be indexed in InnoDB. The ->> operator is shorthand for extract-and-unquote and is what makes the column a real string rather than a JSON string with quotes in it.