[erlang-questions] Conceptual questions on key-value databases for RDBMs users

Edmond Begumisa <>
Wed Nov 3 09:30:49 CET 2010


> * Is there any guide, tutorial, book, whatever, that tries to introduce
>   NoSQL databases to SQL users?

The CouchDB book is very good for making the mental transition from SQL to  
NoSQL in general..

http://guide.couchdb.org/draft/index.html

I think a lot of the data organisation concepts described therein are  
transferable in principle to Mnesia (JSON --> Records, JavaScript -->  
Erlang).

> * Key-value databases are surprising simple.  I know you solve
>   relationship by denormalizing data.  What data should be normalized?
>   What shouldn't?

Ahh, yes, the relationship question! There is no one-size fits all answer  
to this. There are various NoSQL approaches to relationship modeling with  
different levels of denormalisation and having different advantages and  
disadvantages. You might find this article helpful...

http://wiki.apache.org/couchdb/EntityRelationship

Again. I believe in principle, the techniques described are transferable  
and actively used by Mnesia developers (I'm not an Mnesia user myself.)

> How do you update denormalized data?

This normally involves a trade-off between having a separate record that  
represents related data and updating that once, or completely  
denormalising and updating all related records (see wiki link above.) I  
usually only denormalise data for which I'm unlikely to need to update  
several copies of.

For example, for a receipt, I'd have an embedded copy of a customer  
record. When I update the customer record, I won't update related receipts  
coz I don't DON'T want the receipts to be updated anyway since a receipt  
should be an exact unmodified snapshot of history.

In contrast, for an order, I'd have a embedded only a reference to a  
customer record, because if someone changes the customers address, I'd  
want all related orders to reflect that without needing to map through and  
change them (though for some other cases I might do just that.)4

It's very case-by-case. Other factors like replication and query  
performance come in to play too. From my experience, it's something that  
you kinda figure out as you go changing your mind here and there.

- Edmond -


On Wed, 03 Nov 2010 07:14:42 +1100, Silas Silva <> wrote:

> This is a message I sent to the 
> discussion group.  I thought it might be interesting to send it
> erlang-questions, so here we go...
>
>
> Hi all!
>
> I have used SQL RDBMSs for some time.  I've never used any very advanced
> feature, but I know enough of it to make database applications.
>
> Nowadays, I decided it would be interesting to learn some NoSQL
> databases concepts.  So I decided to pick up some Erlang and Mnesia, its
> native key-value database.  More than scalability itself, the most
> valuable feature for me is the possibility of replication and
> synchronization between nodes.
>
> But all pros have cons as companion.  The lack of a relationship model
> is difficult for who is used to RDBMSs.  So, my question is:
>
> * Is there any guide, tutorial, book, whatever, that tries to introduce
>   NoSQL databases to SQL users?
>
> * Key-value databases are surprising simple.  I know you solve
>   relationship by denormalizing data.  What data should be normalized?
>   What shouldn't?  How do you update denormalized data?
>
> Sorry for such simple and general questions.  Things were simple up to
> the moment that I realized that it would be easily solved with a JOIN
> SQL statement.  :-)
>
> Thank you very much!
>


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


More information about the erlang-questions mailing list