[erlang-questions] Conceptual questions on key-value databases for RDBMs users
Mon Nov 8 11:06:19 CET 2010
On Mon, 08 Nov 2010 04:16:43 +1100, "Edmond Begumisa"
> The main reason I've switched to NoSQL (CouchDB) after many years of
> using SQL-RDBMSs is for modeling hierarchical data. RDBMSs force you
> to do this with relationships across different tables even when the
> data belongs to the same domain/object -- this feels unnatural and
> results in the DB equivalent of spaghetti code with hours staring at
> relationship diagrams.
The relational model can express hierarchical relations. SQL cannot
express the whole relational algebra, but it does allow to handle
hierarchical relations. You can use self-referencing tables:
CREATE TABLE hierarchy (
id INTEGER PRIMARY KEY,
ON UPDATE CASCADE
ON DELETE RESTRICT,
And then you could use common table expressions in queries:
Funny note: the relational model was developed 40 years ago in
order to provide a declarative and formal method for structuring
data, and overcome the limitations of the DBMSs of the time ---
which were, in fact, mostly hierarchical and document-oriented,
and required a procedural interface in order to perform queries.
As a result, the data in hierarchical DBMSs was structured without
formal analysis, and only considering the immediate requirements of
the application that was going to use it. When other applications
needed to access the DB, or the application itself required updates
which broke the mapping between DB objects and application objects,
then *huge* pains would arise...
Alceste Scalas <>
More information about the erlang-questions