Header image

Symfony Finland
Random things on PHP, Symfony and web development

MySQL 5.7 brings sexy back with JSON

NoSQL has been the darling of backend developers clamouring for high performance. NoSQL is fine for many uses, but many systems still use MySQL (or other relational databases) for data storage - and will continue to do so in the future.

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:

Note that there's also a series of MySQL 5.7 Power Tech Tour events organised by Oracle ongoing in Fall 2015:

Written by Jani Tarvainen on Wednesday October 21, 2015
Permalink - Tags: mysql, lamp, php, nosql, mongodb

Leave a comment

comments powered by Disqus

« Running Symfony Applications with PHP-PM or PHPFastCGI - State of the LAMP in 2015 »