-
Notifications
You must be signed in to change notification settings - Fork 716
Document column type [Deprecated]
Manuel edited this page May 30, 2018
·
1 revision
To store JSON documents, we introduce a new column type "document". For example, you can create a table with a document column, just like any other column types.
-- the tables below will work for all test cases on this wiki
create table t1 (
id int(8),
doc document,
primary key(id)
) engine=innodb;
-- now you can insert JSON data directly into a document column.
insert into t1 values
(1, '{"name":"Alex",
"phone":6507770001,
"address":{"houseNumber":1001,
"street name":"main",
"zipcode":98761,
"state":"CA"},
"cars":["Ford", "Honda", "BMW"]}'),
(2, '{"name":"Jack Walters",
"address":{"houseNumber":"100",
"street name":"main",
"zipcode":94403,
"state":"WA"},
"children":["Alex", "Ben", "Gary", "Jennifer"]}')
;
-- use for JOIN query examples
create table t2 engine=innodb as select * from t1;
Below is a list of properties and current limitations of document column type.
- JSON inserted into document column are always validated
- Internally we convert JSON into a binary format. So white spaces in the input JSON will not matter and will be removed in storage.
- The max size of a document column is up to 16MB.
- A document column cannot be part of a primary index.
Documentation license here.
Installation
MyRocks
- Overview
- Transaction
- Backup
- Performance Tuning
- Monitoring
- Migration
- Internals
- Vector Database
DocStore
- Document column type
- Document Path: a new way to query JSON data
- Built-in Functions for JSON documents
MySQL/InnoDB Enhancements