MySQL 5.7 brings sexy back with JSON
Adding layers such as Redis, MongoDB or ElasticSearch for features or performance add complexity to your stack, but are necessary in some cases. With the latest release of the Open Source relational database MySQL comes a feature that allows the use of the server as a SQL + NoSQL hybrid.
Version 5.7.8 of MySQL introduces new features, notably the ability to store JSON formatted data natively. Using the JSON Data Type in MySQL comes with two advantages over storing JSON strings in a text field:
- Data validation. JSON documents will be automatically validated and invalid documents will produce an error.
- Improved internal storage format. The JSON data is converted to a format that allows quick read access to the data in a structured format. The server is able to lookup subobjects or nested values by key or index, allowing added flexibility and performance.
Specialised flavours of NoSQL stores (Document DBs, Key-value stores and Graph DBs) are probably better options for their specific use cases, but the addition of this datatype might allow you to reduce complexity of your technology stack. The price is coupling to MySQL (or compatible) databases. But that is a non-issue for many users.
MySQL is a part of the popular LAMP platform, which itself is continuously evolving with PHP 7 & HHVM and alternative web servers such as H2O and Nginx. SQL continues to be the cornerstone of data storage in the stack and contrarily to popular belief, MySQL is hardly standing still.
Learn more about MySQL JSON datatype usage:
- MySQL 5.7 + JSON slides from Morgan Tocker
- Effective Functional Indexes in InnoDB
- JSON Functions, Part 1 — Manipulation JSON Data
- JSON Functions, Part 2 — Querying JSON Data
- Native JSON Data Type and Binary Format
Note that there's also a series of MySQL 5.7 Power Tech Tour events organised by Oracle ongoing in Fall 2015:
- Russian Federation, Moscow, Oct. 27
- Russian Federation, St. Petersburg, Oct. 29
- Germany, Munich, Nov. 3 Ireland, Dublin, Nov. 4
- Italy, Milan, Nov. 10
- Finland, Helsinki, Nov. 10
- Austria, Vienna, Nov. 11
- UK, London, Nov. 11
- Italy, Rome, Nov. 12
- UK, Linlithgow, Nov. 17
- Sweden, Stockholm, Nov. 17
- Romania, Bucharest, Nov. 19
- South Africa, Johannesburg, Nov. 26
- France, Paris