Chapter 6. Data Modeling
In the previous chapters, you looked at the Aerospike architecture and the facilities the database provides. In this chapter we will discuss how to model data in Aerospike to solve common problems. As with most databases, there are a variety of techniques that can be used to solve the same problem, so we will address some of the pros and cons of various approaches.
Note that there are many different ways to model data in Aerospike, and the appropriate technique depends on the problem trying to be solved. This chapter will introduce some of the more common techniques, but it is by no means exhaustive.
Aerospike Data Modeling
Aerospike supports records that have a structure similar to a relational database and it supports secondary indexes similar to a relational database, so it would seem intuitive that data modeling techniques would be similar to those used in relational databases. However, this is not always the case. To illustrate this, let’s look at a classical way of aggregating data.
Suppose you want to model a customer record. The customer has zero or more addresses associated with it, and the addresses have no business use if they are not associated with a customer. This is the classical case of aggregation and you can represent this as shown in Figure 6-1.
In a relational ...
Get Aerospike: Up and Running now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.