I got some more questions on the new JSON data type and functions
during our TechTours. And I like to summarize the answers in this
blogpost.
Memory consumption The binary format of the JSON data type
should consume more memory. But how much? I did a little test by
comparing a freshly loaded 25,000 row dataset stored as JSON and
stored as TEXT. Seven top level attributes per JSON document.
Average JSON_DEPTH is 5.9 . Let's see:
mysql> DESC data_as_text;[Read more]
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id | int(11) | NO | PRI | NULL | |
| doc | text | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> SELECT COUNT(*),AVG(JSON_LENGTH(doc)) FROM data_as_text;
+----------+-----------------------+ …