Database alternatives?

prafulfillment picture prafulfillment · Nov 19, 2009 · Viewed 11.7k times · Source

I was wondering the trade-offs for using databases and what the other options were? Also, what problems are not well suited for databases?

I'm concerned with Relational Databases.

Answer

Stefano Borini picture Stefano Borini · Nov 19, 2009

The concept of database is very broad. I will make some simplifications in what I present here.

For some tasks, the most common database is the relational database. It's a database based on the relational model. The relational model assumes that you describe your data in rows, belonging to tables where each table has a given and fixed number of columns. You submit data on a "per row" basis, meaning that you have to provide a row in a single shot containing the data relative to all columns of your table. Every submitted row normally gets an identifier which is unique at the table level, sometimes at the database level. You can create relationships between entities in the relational database, for example by saying that a given cell in your table must refer to another table's row, so to preserve the so called "referential integrity".

This model works fine, but it's not the only one out there. In some cases, data are better organized as a tree. The filesystem is a hierarchical database. starts at a root, and everything goes under this root, in a tree like structure. Another model is the key/value pair. Sleepycat BDB is basically a store of key/value entities.

LDAP is another database which has two advantages: stores rather generic data, it's distributed by design, and it's optimized for reading.

Graph databases and triplestores allow you to store a graph and perform isomorphism search. This is typically needed if you have a very generic dataset that can encompass a broad level of description of your entities, so broad that is basically unknown. This is in clear opposition to the relational model, where you create your tables with a very precise set of columns, and you know what each column is going to contain.

Some relational column-based databases exist as well. Instead of submitting data by row, you submit them by whole column.

So, to answer your question: a database is a method to store data. Technically, even a text file is a database, although not a particularly nice one. The choice of the model behind your database is mostly relative to what is the typical needs of your application.

Setting the answer as CW as I am probably saying something strictly not correct. Feel free to edit.