Online / 6 & 7 February 2021


Rewrite Your Complex MySQL Queries for Better Performance

Two MySQL queries that will return the same result, may sometimes have totally different queries plans. This happens because the query optimizer does not realize that the queries are equivalent. In this presentation, we will discuss how we can rewrite queries to help the optimizer find a better query plan. We will show several examples of how we can transform subqueries to make them more efficient, and we will also discuss how we can identify queries that can become faster if a subquery is replaced by window functions. Finally, we will discuss how MySQL 8.0 can do some of these transformations automatically.


Photo of Øystein Grøvlen Øystein Grøvlen