Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Ravi.

Asked: July 27, 2018 - 5:53 pm UTC

Last updated: July 30, 2018 - 1:14 pm UTC

Version: 12c

Viewed 1000+ times

You Asked

There are several Database design patterns floating around for various application usages. Tree and Hierarchy Patterns are one of those.

I see most of the hierarchy patterns implemented as a self referencing table. There are also other implementation like closure, nested sets etc.

In your opinion which pattern you recommend for which kind of usage for hierarchy? I am particularly interested in high volume data/query outputs.

Thanks!

and Chris said...

MySQL consultant Bill Karwin has a great presentation comparing adjacency lists, path enumeration, nested sets, and closure tables for storing hierarchies:

https://www.slideshare.net/billkarwin/models-for-hierarchical-data

You'll have to adjust some of the SQL to work in Oracle Database. But the underlying principles are the same.

If you want more tailored advice, you'll need to give us sample data and more details of what precisely your requirements are.

What kind of queries will you run? How will you need to add/remove nodes from the tree? What counts as "high volume" to you?

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Design

New to good database design? Check out Chris Saxon's full fundamentals class.