[MDEV-9144] JSON data type Created: 2015-11-17  Updated: 2017-09-27  Resolved: 2017-07-05

Status: Closed
Project: MariaDB Server
Component/s: Data types, JSON
Fix Version/s: 10.2.7

Type: Task Priority: Major
Reporter: Sergei Golubchik Assignee: Sergei Golubchik
Resolution: Fixed Votes: 13
Labels: None

Issue Links:
Blocks
blocks MDEV-9056 JSON support Closed
Duplicate
duplicates MDEV-11932 JSON DATA TYPE (MySql 5.7.8) Closed
Problem/Incident
causes MDEV-13777 JSON benchmarks Open
Relates
relates to MDEV-13313 JSON type alias is insufficiently com... Closed
relates to MDEV-13916 Enforce check constraint on JSON type Closed

 Description   

JSON data type with validation.

Assorted thoughts:

  • MySQL-5.7 has JSON data type
  • Facebook has a DocStore-patch implementing JSON data type
  • We have Dynamic columns that can be used as a backing store for the JSON data (when MDEV-6632 is done)
  • Pluggable data types (MDEV-4912) might help here


 Comments   
Comment by Sergei Golubchik [ 2017-05-29 ]

JSON data type directly contradicts SQL standard, that says, that JSON_* functions take a string as an argument.

Also, speed-wise MariaDB does not need binary JSON, according to our benchmarks, our JSON parser is as fast on text JSON as MySQL on binary JSON.

That is, in MariaDB one could VARCHAR or TEXT for JSON. If a validation is needed, one can do it with a CHECK constraint:

   my_json_column TEXT CHECK (JSON_VALID(my_json_column))

We'll add JSON "type" for MySQL compatibility, though.

Comment by Sergei Golubchik [ 2017-07-05 ]

added JSON as an alias for TEXT

Comment by Steven WdV [ 2017-09-09 ]

Wouldn't a binary JSON type be even faster and additionally more efficiënt when it comes to storage? It just seems more clean to me.

Comment by Sergei Golubchik [ 2017-09-09 ]

Yes, it might be faster (or not, you never know). But see above — our json functions are already fast (MySQL got ~50x speedup on binary vs text json, our json functions are as fast on text as MySQL json functions on binary *)); and binary json type directly violates the SQL standard.

We've used SQL standard approach to JSON, and implemented it to be fast without resorting to binary format.


*) results from our entirely non-scientific benchmarks

Comment by Colin Charles [ 2017-09-10 ]

hi serg - these benchmarks, where are they published so others might repeat them? thanks

Comment by Sergei Golubchik [ 2017-09-10 ]

I'm afraid not, they were very ad-hoc, the point was not to get exact numbers, but to steer the development-in-progress.

I've created MDEV-13777, to do proper benchmarks that can be published.

Generated at Thu Feb 08 07:32:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.