clickhouse删除数据常见报错

clickhouse 删除数据常见异常

  • Expected one of: DATABASE, TEMPORARY, TABLE

truncate login_log_struct;

Syntax error: failed at position 10:

truncate login_log_struct;

Expected one of: DATABASE, TEMPORARY, TABLE

解决方案

drop table login_log_struct;

  • Code: 359. DB::Exception: Received from localhost:9000. DB::Exception: Table or Partition in 库.表 was not dropped.

drop table login_log_struct;

# 分区删除,不超过50GB, 表删除,不超过200GB
Received exception from server (version 19.15.3):
Code: 359. DB::Exception: Received from localhost:9000. DB::Exception: Table or Partition in flash.flash_login_log_struct was not dropped.
Reason:
1. Size (1.09 TB) is greater than max_[table/partition]_size_to_drop (200.00 GB)
2. File '/data/clickhouse/flags/force_drop_table' intended to force DROP doesn't exist
How to fix this:
3. Either increase (or set to zero) max_[table/partition]_size_to_drop in server config and restart ClickHouse
4. Either create forcing file /data/clickhouse/flags/force_drop_table and make sure that ClickHouse has write permission for it.
Example:
sudo touch '/data/clickhouse/flags/force_drop_table' && sudo chmod 666 '/data/clickhouse/flags/force_drop_table'.

解决方案

  1. 修改200G的限制,这个功能主要是怕操作不当,一次性直接删除了全表数据,建议不要修改;
  2. 删除占用磁盘较大的字段,当数据量小于该限制,就可以使用删除表了

操作一:
alter table login_log_struct drop partition (‘202012’,‘20201231’);
操作二:
alter table login_log_struct drop column field1;

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值