【问题标题】:Is it possible to update primary key in clickhouse using MergeTree engine?是否可以使用 MergeTree 引擎更新 clickhouse 中的主键?
【发布时间】:2019-09-22 09:46:18
【问题描述】:

我正在尝试更新简单表中的主键。

当我像这样执行查询时:

alter table test update id = 2 where id = 1;

我看到了消息:

Cannot UPDATE key column `id`

有什么解决方法吗?

【问题讨论】:

    标签: clickhouse


    【解决方案1】:

    没有。作为一种解决方法,您需要将主键更改为不需要更新的不同列。这无法就地完成,因此您需要使用正确的主键创建新表,然后通过 INSERT+SELECT 或clickhouse-copier 迁移数据。

    【讨论】:

      猜你喜欢
      • 2020-11-09
      • 2021-10-13
      • 2018-03-11
      • 2021-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-19
      相关资源
      最近更新 更多