Skip to content
Contents/CH 32
Distributed & Analytics/Intermediate · 12 min

HDB vs NDB vs RDB & Data Mining vs Query

The three classic models are not just history. Each one answers a different question about how data should be structured and accessed.

In plain English

A tree, a road map, and a spreadsheet are each good for a different question.

The one idea

Model choice and query type are separate decisions: choose structure for the relationships, and choose analytics for the question.

A hierarchical model can be perfect for a bill of materials and wrong for a reservation graph. A relational database can run both transactions and analytics, but not always well at the same time.

By the end

  1. 01Compare hierarchical, network, and relational models.
  2. 02Distinguish navigation from declarative access.
  3. 03Distinguish a data-mining query from a normal query.
  4. 04Choose a model for a given workload.
01

HDB vs NDB vs RDB

Hierarchical: tree, one parent, fast one-to-many navigation, awkward many-to-many. Network: graph of sets, supports many-to-many, still navigational. Relational: tables, declarative queries, logical independence, the default for general-purpose data. Object and document models extend the relational idea with nested or flexible structures.

chapter-32.db
HDB: tree, one parent, navigational
NDB: graph, multiple parents, navigational
RDB: tables, declarative, set-based
02

Data mining versus normal query

A normal query retrieves known data with a precise predicate, such as "orders over 100 in March." A mining query searches for patterns or predictions, such as "which customers are likely to churn?" The first is deterministic and often aggregate. The second is statistical and evaluated on held-out data.

03

Choosing a model

Use a relational database for transactional integrity and ad hoc queries. Use a document store for evolving nested data. Use a graph database when relationships are the primary query. Use a warehouse for analytics and a mining tool for prediction. The model should follow the workload, not fashion.

Worked example3 steps

Three models, three questions

A manufacturer needs a parts explosion, an airline needs route connectivity, and a bank needs account transfers.

01

Model the parts explosion as a hierarchy.

Parent-child navigation is natural, and shared parts expose the model's weakness.

02

Model the airline as a graph of connected routes.

Many-to-many paths are first-class instead of duplicated.

03

Model the bank relationally with ACID transactions.

Keys, constraints, and recovery protect the transfer invariant.

ConclusionThere is no universal model. There is a model whose costs land on the queries you can afford to make expensive.

The trade-off

No free correctness.

Gain

A clear vocabulary for comparing models and workloads.

Cost

Real systems mix models, and the boundaries are rarely pure.

Verdict

Choose for the invariant and the dominant query; document the queries you are making expensive.

Recap

What to keep.

Takeaways

  • +HDB is a tree; NDB is a graph; RDB is tables.
  • +HDB and NDB are navigational; RDB is declarative.
  • +Normal queries retrieve known data; mining finds patterns.
  • +Mining is statistical and needs evaluation.
  • +Choose the model based on the workload.

Traps

  • !Assuming the newest model is always the right model.
  • !Treating mining as a synonym for reporting.
  • !Ignoring the cost of navigation in legacy models.

Focus

  • →Compare the three models in one table.
  • →Give one example of a normal query and one mining question.
  • →Match a workload to a model.

Check yourself

Before you turn the page.

0 / 2 answered
01

Which model uses a tree with one parent per record?

02

How does a data-mining query differ from a normal query?

DB//COSMOS

A field manual for database systems: model the domain, normalize the facts, query the relations, and protect the result.

Edition 2026 · 32 chaptersTopic catalogInterview prep