How We Work On Queries At GitHub
With a platform that serves millions of people every day, we have a number of services that need to query MySQL. GitHub.com is a large Rails application with a lot of queries generated though ActiveRecord.
Occasionally we will get a slow query appear in our exception tracker Haystack:
I’ve mentioned previously that we tag queries so we can see exactly where they come from.
When we want to investigate the cause of a slow query we can use our
/explain tool with Hubot which you can find here.
Being able to explain queries in chat may seem like a neat toy but it actually provides insight for everyone in the room. This is a great way to discuss the problem and learn from each other.
If we want to test out new indexes or columns we can clone tables onto our staging environment using Hubot:
Once we have decided if we want to modify our schema we can perform an incremental rollout across our cluster. I will cover this more in another post.
I hope this short post gives you a quick insight to how we collaboratively work on queries at GitHub.