如何在MySQL中的json列上创建索引? [英] How to create index on json column in MySQL?

查看:1033
本文介绍了如何在MySQL中的json列上创建索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在MySQL服务器中以Json数据类型在子文档上创建索引?

How to create index on sub-documents in Json data type in MySQL server?

我知道我们必须从基表创建一个生成的列,然后需要索引该列是虚拟的还是存储的。

I know we have to create a generated column from the base table and then need to index that column Virtually or stored.

但是我想要为子文档创建生成的列的语法。

But I want syntax for creating a generated column for sub-document.

推荐答案

JSON列(与其他二进制类型的列一样)不会直接建立索引;相反,您可以在生成的列上创建索引,以从JSON列提取标量值。请参见二级索引和生成的虚拟列 ,以获取详细示例。

JSON columns, like columns of other binary types, are not indexed directly; instead, you can create an index on a generated column that extracts a scalar value from the JSON column. See Section "Secondary Indexes and Generated Virtual Columns", for a detailed example.

这篇关于如何在MySQL中的json列上创建索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆