Question

Is there any open-source hierarchical database or emulation atop of existing RDBMS?

I am searching a DMBS (or plugin to existing RDBMS) which can store hierarchical data and permits to perform queries on hierarchical data (something like "SELECT LEVEL ... CONNECT BY ...", "SELECT PARENT ..." for example). I know there is some support in Oracle, but is there a more complex solution?

Was it helpful?

Solution

There isn't a standardized plugin for doing this. I've looked more than once. However, there are a number of options. See from my earlier question on the same topic:

What are the options for storing hierarchical data in a relational database?

In short, if you're using a table with ID and ParentID (a.k.a. adjacency list) you use Common Table Expressions with most databases (Oracle's CONNECT BY being one of the most notable exceptions). OTO, something like materialized path or nested sets may be a better fit for your situation - for instance ability to easily find "lineage" where with adjacency list this is an expensive operation.

Usually what ends up happening with a system that needs to work extensively with hierarchical data, for instance a CMS, is that it implements more than one of these solutions. The assumption is reads heavily outweigh writes.

OTHER TIPS

Relational data doesn't directly support hierarchies in the way that an inherently hierarchical structure like XML does. You have to use a data model such as nested sets or a straight self-join to model the hierarchy.

Depending on the type of system you have, Common Table Expressions will let you run hierarchical queries on data. CTEs are supported by SQL Server versions since 2005, Recent versions of DB/2 and PostgreSQL - and probably some other systems. CTEs are a bit more fiddly than CONNECT BY, but they do run on a fair variety of platorms.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top