Indexing 在Clickhouse中的现有表上创建索引

Indexing 在Clickhouse中的现有表上创建索引,indexing,clickhouse,secondary-indexes,Indexing,Clickhouse,Secondary Indexes,我正在尝试使用以下语法在现有表上添加索引 在..中创建表格联系人_。。。。。 ( ....... 域字符串, 主题字符串, 类别字符串 ...... ...... ..... ..... )引擎=按类别合并树分区 订购人 (主题,域)设置索引粒度=8192 I want to create an index on the topic column (granularity is 6020) tried syntax from the documentation but unable to un

我正在尝试使用以下语法在现有表上添加索引

在..中创建表格联系人_。。。。。 ( ....... 域字符串, 主题字符串, 类别字符串 ...... ...... ..... ..... )引擎=按类别合并树分区 订购人 (主题,域)设置索引粒度=8192

I want to create an index on the topic column (granularity is 6020)

tried syntax from the documentation but unable to understand since there is no examples explaining the fields in it.
有人能快点帮我吗。

是的,你能

以下操作可用:

ALTER TABLE [db].name ADD INDEX name expression TYPE type GRANULARITY value AFTER name [AFTER name2] - Adds index description to tables metadata.

ALTER TABLE [db].name DROP INDEX name - Removes index description from tables metadata and deletes index files from disk.

ALTER TABLE [db.]table MATERIALIZE INDEX name IN PARTITION partition_name - The query rebuilds the secondary index name in the partition partition_name. Implemented as a mutation.

看看