CREATE INDEX Statement mysql>  ALTER TABLE customers -> ADD UNIQUE INDEX zips((CAST(custinfo->’$.zipcode’ AS UNSIGNED ARRAY))); ERROR 1062 (23000): Duplicate entry ’[94507, ’ for key ’customers.zips’ mysql>  ALTER TABLE customers -> ADD INDEX zips((CAST(custinfo->’$.zipcode’ AS UNSIGNED ARRAY))); Query OK, 0 rows affected (0.36 sec) Records: 0 Duplicates: 0 Warnings: 0 Characteristics of Multi-Valued Indexes Multi-valued indexes have the additional characteristics listed here: Limitations and Restrictions on Multi-valued Indexes •Index records are not added for empty arrays. •Because multi-valued indexes are virtual indexes on virtual columns, they must adhere to the same rules as secondary indexes on virtual generated columns. • JSON  null values are not permitted in indexed arrays. If any returned value is  NULL , it is treated as a JSON null and an  Invalid JSON value  error is reported. •If the typed array column is set to  NULL , the storage engine stores single record containing  NULL  that points to the data record. •If multi-valued key part generation returns a  NULL  value, a single entry containing  NULL  is added to the multi-valued index. If the key part is defined as  NOT NULL , an error is reported. •If multi-valued key part has an empty array, no entries are added to the index, and the data record is not accessible by an index scan. •Nullability and multi-valued indexes: •DML operations that affect multi-valued indexes are handled in the same way as DML operations that affect a normal index, with the only difference being that there may be more than one insert or update for a single clustered index record. •A multi-valued index cannot be a covering index. •The maximum number of values per record for a multi-valued index is determined by the amount of data than can be stored on a single undo log page, which is 65221 bytes (64K minus 315 bytes for overhead), which means that the maximum total length of key values is also 65221 bytes. The maximum number of keys depends on various factors, which prevents defining a specific limit. Tests have shown a multi- valued index to permit as many as 1604 integer keys per record, for example. When the limit is reached, an error similar to the following is reported:  ERROR 3905 (HY000): Exceeded max number of values per record for multi-valued index ’idx’ by 1 value(s). •An index with a multi-valued key part does not support ordering and therefore cannot be used as a primary key. For the same reason, a multi-valued index cannot be defined using the  ASC  or  DESC keyword. •Only one multi-valued key part is permitted per multi-valued index. However, the  CAST(... AS ... ARRAY)  expression can refer to multiple arrays within a  JSON  document, as shown here: 2523 In this case, all values matching the JSON expression are stored in the index as a single flat array. Multi-valued indexes are subject to the limitations and restrictions listed here: CAST(data->’$.arr[*][*]’ AS UNSIGNED ARRAY)