Generated Columns

The MySQL server cannot index JSON columns. Generally, you want indexes to be as small as practicable for speed, and trying to use up to a gigabyte of unstructured data would not be efficient. This situation is similar to that of other data BLOBs. Data from the JSON column, however, can be extracted into a generated column, and that column can be indexed.

There are two types of generated columns. The virtual generated column is evaluated when the column is read but before any existing triggers are fired for that column. The stored generated column is evaluated and stored when data is either inserted or updated. The default ...

Get MySQL and JSON: A Practical Programming Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.