I'm troubleshooting a very slow index on mariaDB. It takes over 10 seconds. The table has over 10M rows. The where clause has 'where a=x and b=y'. Column b has a selective index. Column a has a non selective index (only 5 distinct values), but it's can't be deleted since a is a foreign key. mariaDB is using intersect of the 2 indices, which make it perform a lot worse than using index on b alone. I don't know how to solve this given that:
- I can't delete the index on a since I want to ensure integrity
- I don't want to cancel the intersect index optimization for the entire database
- I don't want to use index hints since it's not standard (even though I'm not sure what other option I got).
Any ideas?