Pregunta

¿Hay alguna base de datos jerárquica de código abierto o de emulación de la cima de RDBMS existentes?

Estoy buscando un DBMS (o plugin para RDBMS existente) que puede almacenar datos jerárquicos y permisos para realizar consultas sobre datos jerárquicos (algo así como "LEVEL SELECT ... CONNECT BY ...", "amigo Elegir ... " por ejemplo). Sé que hay algo de apoyo en Oracle, pero es una solución más compleja?

¿Fue útil?

Solución

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.

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top