Details

    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

      Attachments

        Issue Links

          Activity

            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.

            serg Sergei Golubchik added a comment - 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.

            added JSON as an alias for TEXT

            serg Sergei Golubchik added a comment - added JSON as an alias for TEXT
            StevenWdV Steven WdV added a comment -

            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.

            StevenWdV Steven WdV added a comment - 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.

            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

            serg Sergei Golubchik added a comment - 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
            colin Colin Charles added a comment -

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

            colin Colin Charles added a comment - hi serg - these benchmarks, where are they published so others might repeat them? thanks

            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.

            serg Sergei Golubchik added a comment - 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.

            People

              serg Sergei Golubchik
              serg Sergei Golubchik
              Votes:
              13 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.