This post is based on a true story from one of our team members.
Here at EverSQL, we have high appreciation for the MySQL
database.
Said that, every product has its pros and cons and even some bugs
here and there.
So let’s dive into how we used some “bad practices” to overcome a
potential bug in MySQL’s optimizer.
TL;DR: This case study will describe a scenario where the MySQL
optimizer will not choose to use an existing and allegedly good
index to optimize a search query, which eventually caused a
response time of 80 seconds of a simple page in a web
application.
The Problem
The scenario from a business perspective – the development team
was trying to implement a web page that presents data about the
user actions in the last year.
The scenario from a technical database perspective – The team was
trying to join two (same issue will occur with more than two)
tables and use a range …