We’ve been helping a long-term client who runs some fairly
complex queries (covering lots of tables and logic on a
respectably big but mainly volatile dataset). We tend to look
first at query structure and table design, as fixing problems
there tends to have the most impact. This contrary to just
tossing more hardware at the problem, which is just expensive.
As subqueries are used (and necessary in this case), MariaDB 5.3
was already a great help with its subquery optimisations. Once
again thanks, Monty and the Monty Program optimiser team (Igor,
Sergey, Timour, and possibly others) – all former colleagues and
they’re absolutely awesome. Together, they know the MySQL
optimiser like no other.
Because the queries are generated indirectly from an exposed API
(just for paying clients, but still), the load is more
unpredictable than having merely a local front-end. Maintaining
spare capacity with slaves addresses this, but …
[Read more]