From time to time you may have experienced that MySQL was not able to find the best execution plan for a query. You felt the query should have been faster. You felt that something didn’t work, but you didn’t realize exactly what.
Maybe some of you did tests and discovered there was a better execution plan that MySQL wasn’t able to find (forcing the order of the tables with STRAIGHT_JOIN for example).
In this article, we’ll see a new interesting feature available on MySQL 8.0 as well as Percona Server for MySQL 8.0: the histogram-based statistics.
Today, we’ll see what a histogram is, how you can create and manage it, and how MySQL’s optimizer can use it.
Just for completeness, histogram statistics have been available on MariaDB since version 10.0.2, with a slightly different …
[Read more]