Lesson 4_When to Use Non-Relational Databases
Lesson 4_When to Use Non-Relational Databases
A very common question when you are considering non-relational databases is when
is it appropriate to use them.
2
When to Use Non-Relational?
Non-relational, particularly the document model, is well suited to
polymorphic data that can change frequently.
Let’s discuss some of the aspects around when to use non-relational databases.
3
When to use Non-Relational?
Non-relational, particularly the document model, is well suited to
polymorphic data that can change frequently.
The document model allows for different shapes of data within the same collection,
this means that documents with different fields can be present. It is sometimes
described as holding multiple schema for the collection.
This is a key feature for enabling developer productivity as it provides rapid iteration
of schema versions for data to co-exist within the same database and collection. This
means that developers can rapidly change what fields are in a document and not
worry about the impact or side effects that occur in the database. Essentially, the
database is not a hurdle or an additional burden of work that must be additionally
updated for example when a new field is added.
4
When to use Non-Relational?
Non-relational, particularly the document model, is well suited to
polymorphic data that can change frequently.
Another aspect of non-relational databases is that they often offer exact (or close to
exact) mappings to what objects the developer desire to use in their application code.
This means that the data can be transferred as-is directly to the application without
requiring any additional mapping. In the case of relational databases, information for a
single object may reside in several tables which then need to be JOINed before being
passed to the application. This is the object mapping stage.
5
When to use Non-Relational?
Non-relational, particularly the document model, is well suited to
polymorphic data that can change frequently.
A known pain point for relational databases stems from the initial focus on scaling
vertically, where additional resources were added to the machine or a large machine
as used to support scaling the database.
Non-relational systems took this pain point and deliberately focused on scaling
horizontally, where additional machines were added to the existing machine(s) when
scaling the database. This scaling approach has simplified any changes required for
these databases to support multiple public cloud providers. It has also focused
non-relational systems, firstly on being virtualisation friendly, and more recently on
being container friendly, as two key provisioning technologies that assist in deploying
the database.
6
Quiz
Quiz
Which of the following are true for non-relational databases? More
than one answer choice can be correct.
CORRECT: Deals with polymorphic data - In non-relational databases, you are able to
store differently shaped data in the same collection. Differently shaped data is a key
advantage when compared to relational databases
Quiz
Which of the following are true for non-relational databases? More
than one answer choice can be correct.
CORRECT: Works well with rapidly changing data - Each shape change in the
structure of data requires a change to the database’s corresponding schema if stored
in a relational database. This isn’t the case for non-relational databases.
Continue Learning! Github Student
Developer Pack
MongoDB University has free self-paced Sign up for the MongoDB Student Pack to
courses and labs ranging from beginner receive $50 in Atlas credits and free
to advanced levels. certification!
This concludes the material for this lesson. However, there are many more ways to
learn about MongoDB and non-relational databases, and they are all free! Check out
MongoDB’s University page to find free courses that go into more depth about
everything MongoDB and non-relational. For students and educators alike, MongoDB
for Academia is here to offer support in many forms. Check out our educator
resources and join the Educator Community. Students can receive $50 in Atlas credits
and free certification through the Github Student Developer Pack.