MySQL Forums
Forum List  »  Newbie

Creating multi-valued index on json column
Posted by: Nenad M
Date: March 13, 2020 02:28PM

Hello,

I have table components with json data column.
Here in data column i am expecting to have: {"products": ["a", "b", "c"...]}

I noticed that in MySQL 8.0.17 it is added support for adding multi-values index on json column. In this particular case i want to add index like:

CREATE INDEX products ON components ( (CAST(data->'$.products' AS VARCHAR(255) ARRAY)) );

but it gives me error.
On this link https://dev.mysql.com/doc/refman/8.0/en/create-index.html i found way how to create index for unsigned int type:
CREATE INDEX zips ON customers ( (CAST(custinfo->'$.zip' AS UNSIGNED ARRAY)) );

Is there a way to accomplish the same and create index on json array of strings?

Options: ReplyQuote


Subject
Written By
Posted
Creating multi-valued index on json column
March 13, 2020 02:28PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.