Here at Cloud Four, we are always trying to make performance optimizations on customer Web sites and services. I noticed a custom WordPress plugin that I had written for a client was running a bit slower than I’d like today.
After just a quick bit of debug it was clear that the problem was an 850,000-row MySQL table. The plugin was making simple (read) queries to this table about a dozen times on each page load. This shouldn’t take so long!
I took a quick trip to the MySQL interpreter and added indexes to three columns. Some quick testing showed me that the instantaneous result (it took 10 seconds each to index the columns) netted an instant performance improvement of 193 thousand percent. That’s an improvement that will affect every visitor to this page in the future, and one I’m glad I made.
Adding indexes to a MySQL table is one of those basic-arsenal tools we use; it’s not ground-breaking nor particularly racy. But sometimes, in our valiant quests for speed and elegance, we can forget the simple tactics that make so much difference.