content_image/754899.jpg content_image/754907.jpg
+------------------------------------+------+ 1 row in set (0.00 sec) mysql> SET @j = JSON_SET(@j, ’$[1]’, "json"); Query OK, 0 rows affected (0.00 sec) mysql> SELECT @j, JSON_STORAGE_SIZE(@j) AS Size; +----------------------------------+------+ | @j | Size | +----------------------------------+------+ | [100, "json", [1, 3, 5], 425.05] | 43 | +----------------------------------+------+ 1 row in set (0.00 sec) mysql> SET @j = JSON_SET(@j, ’$[2][0]’, JSON_ARRAY(10, 20, 30)); Query OK, 0 rows affected (0.00 sec) mysql> SELECT @j, JSON_STORAGE_SIZE(@j) AS Size; +---------------------------------------------+------+ | @j | Size | +---------------------------------------------+------+ | [100, "json", [[10, 20, 30], 3, 5], 425.05] | 56 | +---------------------------------------------+------+ 1 row in set (0.00 sec) 

For a JSON literal, this function always returns the current storage space used: 

mysql> SELECT -> JSON_STORAGE_SIZE(’[100, "sakila", [1, 3, 5], 425.05]’) AS A, -> JSON_STORAGE_SIZE(’{"a": 1000, "b": "a", "c": "[1, 3, 5, 7]"}’) AS B, -> JSON_STORAGE_SIZE(’{"a": 1000, "b": "wxyz", "c": "[1, 3, 5, 7]"}’) AS C, -> JSON_STORAGE_SIZE(’[100, "json", [[10, 20, 30], 3, 5], 425.05]’) AS D; 

<img src='content_image/754899.jpg'>

1 row in set (0.00 sec) 

## 12.19 Functions Used with Global Transaction Identifiers (GTIDs) 

The functions described in this section are used with GTID-based replication. It is important to keep in mind that all of these functions take string representations of GTID sets as arguments. As such, the GTID sets must always be quoted when used with them. See GTID Sets for more information. 

The union of two GTID sets is simply their representations as strings, joined together with an interposed comma. In other words, you can define a very simple function for obtaining the union of two GTID sets, similar to that created here: 

CREATE FUNCTION GTID_UNION(g1 TEXT, g2 TEXT) RETURNS TEXT DETERMINISTIC RETURN CONCAT(g1,’,’,g2); 

For more information about GTIDs and how these GTID functions are used in practice, see Section 17.1.3, “Replication with Global Transaction Identifiers” . 

<img src='content_image/754907.jpg'>

