SQL + NoSQL = SomeSQL
A possible solution is to use both SQL and NoSQL. Imagine using a conventional RDBMS for indexing your data along with NoSQL database for storing actual data. Then query your index RDBMS with SQL and fetch full results from NoSQL buckets.
Modeling
- Determine what parts of your data do you want to index.
- Model your RDBMS by putting only index fields there.
- Each table that represents some entity must contain a NoSQL id which links to actual object in your distributed database.
- Model your NoSQL database so that it will store your objects in a serialized way (JSON, XML, ...).
Inserting
- Generate an identifier which will link your NoSQL entry with RDBMS. This can be some object hashcode or an SQL sequence value.
- Write your object into RDBMS (only indexed fields) providing the NoSQL ID. This can be done asynchroniously.
- Write your object into NoSQL DB.
Querying
- Query your RDBMS for indexed fields.
- Retrieve NoSQL ID from query results.
- Fetch objects from NoSQL DB using the NoSQL ID.
No comments:
Post a Comment