2
I started recently to study the performance of the queries in MYSQL, I am trying to use EXPLAIN to go analyzing and improving the indexes of my tables, until I came across the following situation.
I am making a simple query by filtering the users of the domain through the user field_domain, which is a key index.
When I use value 1 to select users belonging to domain 1, it seems that it doesn’t use index and scans all 9 records in the table:
Here, I use the value 2 to select users belonging to domain 2, and in this case, it seems that the index works correctly and selects the records directly.
I noticed this same behavior in some other queries, and a table scan cannot occur in any way because the project is a Saas Multi-tenant, which can lead to extremely time-consuming queries. Does anyone know what it might be?