Hierarchical Database Model
The hierarchical model is a tree. It is fast when your data is a tree and painful when it is not.
In plain English
It is a family tree: each child has one parent, and you follow the branches down.
The one idea
A hierarchical database stores a tree: one parent, many children, and fast navigation along a known path.
It explains why early databases were fast for bills of materials and awkward for many-to-many relationships. The trade-off still appears in modern document and directory stores.
By the end
- 01Explain parent-child records in the hierarchical model.
- 02Trace navigational access through a tree.
- 03Know why many-to-many relationships are difficult.
- 04Identify the strengths and limits of hierarchical databases.
Tree-structured records
A hierarchical database stores records in a tree. Each child has exactly one parent, and a parent can have many children. Access starts at the root and follows a path down the tree. This makes one-to-many navigation fast and predictable, but it fixes the access path into the schema.
Department
├── Employee
│ ├── Dependent
│ └── Dependent
└── Employee
└── DependentNavigational access
The program navigates from parent to child using pointers or path names. There is no declarative query optimizer choosing a plan; the application knows the tree. This is efficient for stable, tree-shaped workloads but brittle when requirements change.
Limitations
Many-to-many relationships require redundant copies or an artificial hierarchy. A child cannot have two parents without duplicating data. Queries that need a different path may be expensive. The model is historically important and still appears in directories and file systems, but it is not the default for new application data.
A shared part in a bill of materials
An assembly contains subassemblies, and the same bolt is used in two different subassemblies.
Store Division → Department → Employee as parent-child segments.
A path query from a division to its employees is direct.
Store Assembly → Subassembly → Part.
A part used in two subassemblies must appear twice.
Update the bolt's supplier.
Every duplicated copy must be found and changed.
ConclusionThe tree is an excellent index and a poor model for shared ownership. Duplication is the price of keeping one parent.
The trade-off
No free correctness.
Gain
Very fast parent-child navigation and a simple physical layout.
Cost
No direct many-to-many relationships; structural change can require rebuilding the tree.
Verdict
Good for strict hierarchies and path queries; weak when entities have multiple parents.
Recap
What to keep.
Takeaways
- +Hierarchical databases are trees with one parent per child.
- +Access is navigational and path-dependent.
- +One-to-many navigation is fast.
- +Many-to-many relationships cause redundancy or awkward workarounds.
- +The model fits directories and stable tree-shaped data.
Traps
- !Trying to model a many-to-many relationship directly.
- !Assuming a child can have two parents.
- !Confusing a hierarchical database with a file directory tree, though the shape is similar.
Focus
- →Draw a small tree and trace a query path.
- →Explain why M:N is hard.
- →Name one modern use of tree-shaped data.
Check yourself
Before you turn the page.
How many parents can a record have in a pure hierarchical model?
What is the main access method in a hierarchical database?