≡ Menu

The importance of keys

We have been having a strange mysql issue with one of our servers. It looks like an infinite loop of some sort is going a tad bit crazy on one of the machines. I haven’t been able to track it down per say, but I will eventually. While looking for it though, I stumbled on the status page for Mysql.

It brought to my attention that some of my queries weren’t being joined properly and that there were various other performance changes that could be made to improve how fast mysql could run. I ended up turning on the slow query log to see where the problems were coming from. This immediately resulted in a “Duh” moment as one of the most common queries I run on this machine resulted in a slower than needed query. It was easily fixed by adding an index to the table, and wha-la… better performance across the board.

If you’ve never taken the time to optimize your tables, or to insure that you have proper index’s on the columns you do a significant number of WHERE’s on, be sure you check into them. Forgetting to do so can result in massive slow downs as your tables continue to grow.