PlanetScale

Indexing JSON in MySQL

Oct 4, 2022Aaron Francis
Indexing JSON in MySQL
SummaryAI, from the source post

This post introduces methods for indexing JSON data in MySQL. It details using generated columns (available in MySQL 5.7+) and functional indexes (available in MySQL 8.0.13+) to indirectly index parts of JSON documents. The post explains the syntax for creating these indexes, demonstrates how MySQL's optimizer can leverage them even when querying the JSON expression directly, and highlights the need for casting when using functional indexes to avoid data type issues.

More from the Vitess-based MySQL replacement trail