views:

265

answers:

3

The requirements for the project I'm working seem to point to using both a relational database (e.g. postgre, MySQL) in combination with a key-value store (e.g. HBase, Cassandra). Our data almost breaks nicely into one of the two data models with the exception of a small amount of interdependence.

This is not an attempt to cram a relational database into a key-value store; they are independent of each other.

Are there any serious reasons to not do this?

A: 

When you say key-value store are you meaning like in a session or a cache type of implementation? There are always reasons to do such things...reading from and writing to a database is generally your most resource intensive operation. More details?

Andrew Siemer
key-value store as in Google's Bigtable or Amazon's Dynamo
Kevin Loney
+3  A: 

It should work fine.

There are a couple of things you need to be aware of / watch out for:

  • Your program is now responsible for the data consistency between the stores, not the relational model.
  • Depending on your technology you may or may not have transactions that span the data stores. Here you might have to program some manual clean up work in the case of a failure.
Shiraz Bhaiji
+2  A: 

I work in SQL DBMS territory, so take that bias into account, but...

As with Shiraz Bhaiji, I worry about the "except for a small amount of interdependence". There are a number of things to think about, the answers to which will help you determine what to do.

  • What happens if something goes wrong with the interdependence? (Customers lose money - then you need to use a DBMS throughout; you lose money - probably the same; someone gets reported as having 3045 points when they really have 3046 - maybe it doesn't matter.)
  • How hard is it to fix up the 'mess' when something goes wrong?
  • How much of the work is on the key-value store and how much is on the DBMS?
  • Can the interdependence be removed by moving some stuff from key-value store to DBMS?
  • How slow is the DBMS when used as a key-value store? (Are you sure there's no way to bring it close enough to parity?)
  • What happens in disaster recovery scenarios? Synchronized backups?

If you have adequate answers to these and related questions, then it is OK to go with the mixed setup - you've thought it through, weighed the risks, formed a judgement, and it is reasonable to go ahead. If you don't have answers, get them.

Jonathan Leffler
I never even thought to consider some of these.
Kevin Loney