在clickhouse中的现有表上创建索引

i5desfxk  于 2021-07-15  发布在  ClickHouse
关注(0)|答案(1)|浏览(5831)

我试图用下面的语法在现有表上添加索引。
在…..(……)中创建表联系人。。。。。。。域字符串、主题字符串、类别字符串……)engine=mergetree partition by category order by(topic,domain)settings index\粒度=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.

谁能快点帮我一下吗。

z4iuyo4d

z4iuyo4d1#

是的,你可以。
以下操作可用:

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.

https://clickhouse.tech/docs/en/sql-reference/statements/alter/index/

相关问题