Skip to content

MySQL going to challenge MongoDB with native JSON ?

When looking at Percona live Santa Clara 2015 agenda I saw two intriguing conferences :
- JSON support in MySQL 5.7
- Docstore: document database for MySQL at Facebook

Both conference are talking about supporting a native JSON type in MySQL ! This sounds really great. I have never seen any blog post or github repository around this subject. This is a good surprise. Having in MySQL a native JSON datatype with set of functions for handling JSON documents, with indexing capabilities, and with good underlying storage sounds very cool!

MongoDB and Couchbase as documents stores have open the road to JSON usage by a database. They built their database on a JSON storage format. PostgreSQL has also introduced a native JSON type with associated functions.

But MongoDB storage foundation were not that solid. Memory-mapped files were the critical piece of the storage engine in MongoDB. The locking with was done at database level. The atomicity of a commit was at a document level. All this impacted concurrency capabilities of the data store.
The NoSQL paradigm of MongoDB also means no join capabilities. It has lead to highly denormalised data model. Excessive denormalisation can hurt as it incurs high space consumption. Efficient indexing required padding to avoid too much work rebuilding index when data changed.  The schema-less nature of the database were the schema is in the code is problematic for application evolution.

Then came TokuDB that build TokuMX to solve some of the flaws of MongoDB. The nice idea was to use the efficient storage capabilities of TokuDB. The storage was more solid with true recoverability, transactions, excellent compression and online operations.

MongoDB maybe inspired by what TokuMX achieved has recently decided to change their product's architecture. MongoDB can now use the WiredTiger storage engine.  This provides document-level locking and compression. But as we all know changing the foundation a house while you live in is not that easy.

The MySQL approach is different. The foundation are very solid. The InnoDB transactional storage engine has huge qualities : high concurrency, reliability, safe crash recovery, on line operations, reliable replication capabilities ...

Building a document store on these foundations might lead to some good end result. We have to wait for feedback from the field . Benchmarks need to be run to show how much one can expect from the MySQL /JSON approach. With the newly added JSON support in MySQL, you can combine the flexibility of NoSQL with the strength of a relational database. I am a big fan of this hybrid approach. This dual approach mixing relational content with the flexibility of schemaless  JSON might turn very attractive in a developer perspective.



Leave a Reply

Your email address will not be published. Required fields are marked *