Awesome guide for DBA, sysadmin, and developers. This guide includes tons of tips and tricks for optimizing MySQL Server version 8.x.
From the guide:
The query optimizer takes queries as input and through a process described in this chapter produces an execution plan as output. I like to describe query optimization as being similar to GPS navigation. An address is a destination. You do not specify how to get there, but you expect the navigation system to evaluate potential routes and advise you on the most efficient one.
SQL queries are similar to addresses, in that the SQL language is declarative. It conveys a final state rather than a procedure of how to get there. Similarly, as a database system will have many indexes (and with joins, many tables), there are also many routes that can achieve the same result.
- Read more: The Unofficial MySQL 8.0 Optimizer Guide