The Top App Development Trends Shaping the Industry in 2024-25 .pdf
How not to Model Data
1. How not to Model Data
Amar Shrestha
Senior Software Engineer
2. What is Data Modeling
Data modeling is the process of creating a visual representation of either a whole information
system or parts of it to communicate connections between data points and structures
3. Gurzu Confidential
3
The goal is to illustrate the types of data used and stored within the system, the relationships among these
data types, the ways the data can be grouped and organized and its formats and attributes.
Student
PK StudentID CHAR(9)
FirstName VARCHAR(30)
LastName VARCHAR(30)
Car
PK VIN CHAR(20)
LicensePlate VARCHAR(30)
Make VARCHAR(20)
Model VARCHAR(20)
Color VARCHAR(15)
FK StudentID CHAR(9)
ParkingSticker
PK SticketID CHAR(9)
LotNumber VARCHAR(30)
FK VIN CHAR(20)
FK StudentID CHAR(9)
Owns/Owned by
Assigned/Assigned to
Assigned/Assigned to
4. Mindset while modeling data
Generally when modeling data, the first thing
that comes to mind is How to store data.
But is this how data modeling should be
done? What would be your ideal approach?
5. Gurzu Confidential
Based on past experiences, the most important thing in
my opinion would be fetching the stored data
7. Gurzu Confidential
Normalization is the process of structuring data in accordance with rules called normal
forms to reduce data redundancy and data integrity.
Normalization
8. Gurzu Confidential
Denormalization is a process to improve the read performance of a database at the expense
of losing some write performance by adding redundant data or by grouping data.
Denormalization
9. Gurzu Confidential
The choice on using normalization or denormalization depends on the requirements of
the project/application we are building
Normalization Vs Denormalization
11. Indexes
An Index is a set of ordered references
to rows of a table, its main purpose is
to improve performance of data
retrieval by reducing the number of
physical pages that the database must
access to read a row.
12. Constraints
Constraints are rules that the database
enforces to improve data integrity.The types of
constraints are:
1. NOT NULL Constraint
2. UNIQUE Constraint
3. DEFAULT Constraint
4. CHECK Constraint
5. KEY Constraint
13. Gurzu Confidential
● Pick correct columns for indexing as wrong index may slow down queries rather than speeding it
up
● Composite Index may speed up some queries as well as slow down some. Find the correct order
of columns
● Heavy use of constraints may slow down insert and update operations
● Foreign key and Foreign key constraints are different.Use constraints when needed
What to Avoid?
Indexes and Constraints
14. Where to Compromise?
As we have seen in the previous topics there are always choices in we
have to make while data modeling. Along with choices there come
compromises