Enabling JSON Document Stores in Relational Systems (2013) [pdf]
pages.cs.wisc.edu
pages.cs.wisc.edu
Seems too good to be true.
The performance impact of inserting/fetching multiple rows per object, multiple SQL joins for a single logical join, etc. would probably be significant. And indexing these tables seems to require indexing every name/value pair, not just the interesting fields. And, of course, the overhead of the translation layer itself.
Also, are relational native joins and ACID guarantees still available at scale?
It's quite fast, you can easily use values like SQL sub-queries and you can index both everything and also specific subsets of the JSON data with expression indexes.
ToroDB creates tables dynamically, which match the types (mapped to columns) of every level of the JSON documents, obtaining a fully relational database. This is effectively "partitioning" (automatically) the documents based on their effective "type".
ToroDB actually uses PostgreSQL as its backend to store the data relationally.
Hope this information is interesting.
Disclaimer: I am one of the developers of ToroDB
http://dsl.serc.iisc.ernet.in/~course/TIDS/papers/daniela.pd...
http://faculty.ksu.edu.sa/mathkour/XML%20DB/A%20Performance%...
[ {"query": { "_queryId":"office-query", "sfql": "SELECT $phone.oid, $s:phone.name, $s:phone.value WHERE $s:phone.name='office'" }}, {"query": { "_queryId":"mobile-query", "sfql": "SELECT $phone.oid, $s:phone.name, $s:phone.value WHERE $s:phone.name='mobile'" }} ]
[ { "_queryId": "office-query", "cmdname": "query", "data": [ { "phone_oid": "3", "s:phone_name": "office", "s:phone_value": "111-112-1113" }, { "phone_oid": "7", "s:phone_name": "office", "s:phone_value": "111-112-1113" } ] }, { "_queryId": "mobile-query", "cmdname": "query", "data": [ { "phone_oid": "4", "s:phone_name": "mobile", "s:phone_value": "222:223:2224" }, { "phone_oid": "8", "s:phone_name": "mobile", "s:phone_value": "222:223:2224" } ] } ]
My idea was to write a PG extension which would handle all the smarts, and expose a set of sql functions which could be called from the application side. Those functions could then be wrapped in nice client libraries to give a consistent mongo-a-like interface across languages, with the client doing the bare-minimum to shuttle data to and from the database server.
The query operations would probably be straight-forward, but I could see issues with the write operators mongo has. For instance, if the relational database doesn't support atomic updates within json documents then it may be hard to match the meaning of mongos $set operation, etc.
EDIT: I tried doing exactly this as a clojure library (https://github.com/ShaneKilkelly/clj-bedquilt)
For my purposes I'm pretty much sure we will be looking for something on top of Postgres.
Thanks