Speed up your Database!
DevSnack #55: When building systems, we must consider a lot of things with regard to manipulating stored data, so that they perform efficiently. When domain/business data is little there is not much to worry about, however, as it grows, latency becomes a key factor to be cautious about, since it could potentially make our whole system to behave poorly, subsequently provoking an overall negative impact/perception towards our user base’s eyes.
There are several things we can do to make our database perform better; from properly saving our data, to designing well-formed data structures to optimize our database operations.
Every time we tackle any given problem, we first need to be able to thoroughly define it. Now, when it comes to boosting our system performance, we should first isolate whether the database is the one actually causing the slowdown. In this article, Gorjan Todorovsk (@gorjant) presents a few strategies to help us out in getting to the bottom of it.
In this post, Eran Galperin (@erangalperin) provides a good starting guide to optimize database performance. Here he outlines a variety of concepts, including some that are essential for determining exactly what you should be looking at, what to tweak in your database and how you should do it.
One of the most relevant aspects to take into account while storing data is to follow and tailor standards and practices. In that sense, it is strongly encouraged to normalize tables and columns to reduce redundancy and to ensure data integrity. In this article from Scott Ambler (@scottwambler), he explains the three most common forms of normalization.
As developers, we should adhere to industry-wide, commonly-accepted ways of managing our database. We should enforce ourselves to efficiently design our queries, so that performance does not suffer while running unnecessary and highly-resource-consuming tasks and calculations. Another basic (but often overlooked) thing we should be doing at all times is creating indexes to speed up querying operations. In this article Rodrigo Koch elaborates on these concepts (and some others).
#5 – Caching Techniques
Another way to speed things up is to avoid running the same query multiple times. To achieve this, you may use caching techniques, so that the results of certain recurring queries get temporarily saved. This article by Jakov Jenkov (@jjenkov) talks about caching techniques, how they work, their advantages and practical usages.
DevSnack by Moove-it is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.