Optimizing performance with schema denormalization
In this recipe, we will see how schema denormalization can help improve database performance, and what should be done before executing this operation.
Getting ready
We will implement a database schema representing a group of friends and their phone numbers. The following are the requirements for the database:
For each friend, we want to store the name, surname, and gender
Each friend may have multiple phone numbers
For each phone number, we want to know its type of usage (home, work, mobile, and so on)
A phone number can be shared by more than one friend, for example, Mrs. and Mr. Smith will share the same home number—at least until they get divorced
For each phone number we want to store, we need to know its availability, that is, working hours, evening, afternoon, weekend only, and so on
The following is the logic schema that we will implement to satisfy the requirements mentioned earlier:
How to do it...
The following steps will demonstrate schema...