Understanding basic facts about databases
Let's understand a few facts about databases.
Fact 1 – databases are more frequently read from than written to
In almost all applications, except in the rarest of rare cases, a piece of data is read many times and written to or changed a few times. It's important to keep this fact in mind when we try to optimize queries. Let's look at a few examples.
First, let's consider a site http://www.expedia.com. The flight fares for a specific route get updated a few times at most for a specific class of seats and a specific date range. However, these sets of data will be queried many, many times by users around the world before a booking (a set of writes) eventually happens. This is often referred to as look to book ratio. It can range from 10:1 to a really high ratio like 50:1 or more in some cases.
Let's consider banking applications. We very often check our account balances. Even when we use an online platform with the sole purpose of transferring money to...