MySQL Index Improvement

I’m very pleased with myself today. I actually bothered to track down what was slowing down my website.

I’d first like to say I prefer the word indices to indexes. Also it’s My-S-Q-L not My-Sequel. Actually it’s MariaDB, but that’s not the point.

There were 2 parts of the website that worked painfully slow and I assumed it was something to do with Twitter, but when I actually bothered to check it was that the database wasn’t using the right index. I looked up how to force/suggest the correct index and the query went from taking 2-5 seconds to taking under a tenth of a second!

Excellent result as I pictured having to rewrite several big chuncks of code! This took much less time and effort!

Written by Paul in coding on Tue 19 June 2018. Tags: coding,


comments powered by Disqus