liveBook · Manning

Aggregate orientation

As explained in Grokking Software Architecture

Aggregate orientation is a data-modeling approach that groups related data and treats the group as a single atomic unit.

Aggregate orientation groups related data into one atomic unit, called an aggregate. Think of it as grabbing one box containing everything needed for an entity, rather than searching several cabinets. section 8.2.2

A customer in one document

A customer’s profile, addresses, and recent orders can be bundled into one document. The application can retrieve the information in one database operation instead of joining separate tables. section 8.2.2

Figure 8.3 Showing how NoSQL Document databases store data. Instead of splitting a customer and their orders across separate tables linked by Foreign Keys, all related information is nested into a single, self-contained document. When the application asks for Alice's profile, the database returns her orders at the exact same time; no expensive "Joins" required!

Compare a customer and orders nested in one document with data split across related tables. section 8.2.2

The tradeoff is in how the data is used. Reading a whole aggregate can be fast, especially at scale, but updating a particular piece across many aggregates can mean opening every box. section 8.2.2

How Grokking Software Architecture covers it

How deep it goes
Defines aggregates and contrasts retrieval and cross-aggregate updates with normalized relational storage.
Examples
Illustrates a customer document containing a profile, addresses, and recent orders.
What you can do after
Evaluate aggregate-oriented storage by weighing single-operation reads against updates spanning multiple aggregates.
How it connects
Connects document databases with relational databases, normalization, joins, and horizontal scaling.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.