Migrating from MySQL to NoSQL (Aerospike)


#1

In current application there are lot of queries with joins between table. As Aerospike is not an relational DB all such queries will be modified. Is there any guideline in place for such migration. It seems migration will lead to lot of changes in Application.


#2

Mangesh,

RDBMS generally store data in normalized form to avoid duplication of data. So when trying to recreate the entire fact you actually perform join. To give you example. If you have three facts

  1. User U1 bought product P1.
  2. User U1 bought product P2
  3. User U2 bought product P1

This information will be stored to avoid duplication of information about user user and production and location as

Usertable U1 -> All user information U2 -> All user information

Producttable P1 -> All the product info P2 -> All the product info

Facttable E1, U1, P1 E2, U1, P2 E3, U2, P1

To recreate you would run SQL something like (Syntax not checked)

select * from Usertable as U, Facttable as F, Producttable P where F.Event = E1 and F.User=Usertable.User and F.Product = Producttable.Product

In the key-value store world there is no deduplication done so data is simply stored as (Note this could be done in many different ways based on how data is modelled … this one is just a naive example)

E1 -> P1 along with all product info -> U1 along with all user info E2 -> … E3 -> …

When querying system you would simply lookup data like

select * from eventtable where Event = E1

So if you need to migrate the data from RDBMS which perform lot of joins then you need to denormalize it to store in any Key-Value Store.

HTH

– R