Database design
For new systems, we have the luxury of designing our databases with performance in mind. Our database’s design can have a significant impact on the efficiency of our SQL queries. In this section, we will examine key principles of database design, including schema, indexing, partitioning, and sharding.
Schema principles
Database schema
A database schema is the design of the database, serving as a blueprint to create it.
Before we create our database, we should create a schema to document how our data will be organized and to indicate how it is interrelated. Our goal is to design a schema that makes querying the database more efficient.
An early decision to make is whether our database will be normalized or denormalized. A denormalized database involves reducing the number of tables to decrease the complexity of queries. Conversely, normalization involves creating separate tables to eliminate duplicative data. Let’s look at an example.
...