Why Should I Use Google Big Table or any non relational database for that matter?

One of the very first things that comes to a web developer’s mind when faced with the option of developing an application on
Google App Engine is the fact that the database is non relational and also that you cannot instantly do “Joins” on your data!
At first glance this seems like a major bottle neck but then it all begins to make sense once you get one thing straight and that is :
Non-relational databases (Google Big Table, CouchDb, Mongo etc) are not nessecarily a one size fits all replacement for relational Databases (e.g. My SQL, Oracle, SQL Server) .
They each have situations to which they are best suited and once you have understood that, life becomes a whole lot easier.
Having said that, there are developers who have sworn to stick to one side of the divide (relational or none relational ) and as such have done everything within their power to adapt their applications to their databases of choice.
So the big question is: When is it best to use a non-relational database like BigTable ?
Well…the answer varies depending on who you talk to, but some digging around the web yielded the following answers:

  • Your data is stored and retrieved mainly by primary key, without complex joins.
  • You have a non-trivial amount of data, and want to avoid the pains of RDMS management such as Replication etc
  • Your data mirrors a real life document or log/audit trail (e.g. a ticket, a receipt or even an invoice) whose contents will not change once it has been created and/or is used in an “append-only” mode

Another possible reason is if you have a strong suspicion that your database will NOT age gracefully (see http://push.cx/2009/rules-of-database-app-aging )
Putting the above scenarios together could result in the following picture:
You have to build an application that underneath is very simple in structure, but will potentially handle a lot of data with high traffic and you want to be able to retrieve data from this application using a primary key and/or also some key words/tags (a many to many relationship). Such an application is a good candidate for a database such as BigTable.

Of course like was said earlier a lot of developers have over the years found ingenious ways to use non-relational databases to achieve a lot of the things that are currently being done with relational databases today.
Also suffice to say that Google has unleashed App Engine for Business and in the second quarter of this year this will support hosted SQL databases. This initiative will make it easier for business to migrate their business applications and databases to the Google Cloud.



It would be interesting to hear from you about situations where you have considered moving from a relational database to a non-relational database and vice versa.
Here are some articles that should make interesting reading: