![]() ![]() Transaction_started.hours_used as total_hours_used, Transaction_ction_count as total_section_assignments_posted, Transaction_ction_count as total_section_assignments_complete, Transaction_started.total as total_assignments_posted, Transaction_complete.total as total_assignments_complete, This query ends up looking like this: select Number of hours used (schools typically pay for packages of “hours”)Īs you can imagine, this data is stored in various tables throughout our database, so in order to query it, we would need to join lots of data in a single large query.Number of assignments the teacher has requested a revision for.Some of the information we track about teachers includes: We have several database tables that contain information about how teachers use our platform, and we must check this usage from time to time to generate reports for school leaders who pay for our services. Our application ( The Graide Network) is a grading platform where we grade essays for teachers. ![]() This is naive like any tool in a programmer’s toolbelt, views have a place, but must be used with knowledge of the tradeoffs. Let’s back up because a lot of people argue that MySQL Views shouldn’t be used due to performance issues. The school_summaries view uses the teacher_summaries view to show internal team members how many assignments teachers at each school have posted, how many they’ve reviewed, and a bunch of other disparate information. This was hugely valuable for tracking down the root of the problem.Īfter watching queries for about a week, two database queries topped my list for the slowest in our system:īoth of these select statements are querying two related MySQL views. In order to track down why the request was slow, I installed Datadog, which offers more detailed, query-level data on how requests are performing. While this request was not very common (and only used by internal company employees), it still indicated an area for improvement in our codebase. This tool provides a very helpful, high level view of which requests to your website are not performing well, and it can help you find bugs, memory leaks, and optimizations for your database queries.Īfter a few weeks, I noticed that two requests were especially slow - consistently taking 3-5 seconds per request. Last year I started logging slow requests using PHP-FPM’s slow request log. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |