当前位置:网站首页>clickhouse online and offline table
clickhouse online and offline table
2022-08-04 17:33:00 【High concurrency】
1.background
I like to drop the table directly when I delete the table. When I recently encountered the drop table, the table was being written or other operations were performed, which caused the deletion of the table to fail.The operation is stopped, and then go to delete.
2. Description
Offline: DETACH TABLE|VIEW|DICTIONARY [IF EXISTS] [db.]name [ON CLUSTER cluster] [PERMANENTLY]
Online: ATTACH TABLE|VIEW|DICTIONARY [IF EXISTS] [db.]name [ON CLUSTER cluster] [PERMANENTLY]
Official website translation:
Detach does not delete data or metadata for tables, materialized views, or dictionaries.If an entity is not permanently detached, the next time the server starts, the server will read the metadata and recall the table/view/dictionary again.If an entity is permanently detached, there will be no automatic recall.Regardless of whether the table or dictionary is permanently detached, in both cases they can be reattached using an ATTACH query.System log tables can also be appended to the back (eg query_log, text_log, etc.).Unable to reconnect other system tables.At the next server startup, the server will recall these tables again.ATTACH materialized views cannot use short syntax (no SELECT), but it can be attached using an ATTACH TABLE query.Note that already detached tables (temporarily) cannot be detached permanently.But you can take it back and separate it permanently.You also cannot DROP the detached table, or use a CREATE table with the same name as the detached table, or replace it with another table with a RENAME table query.3. Action
# test tableCREATE TABLE IF NOT EXISTS test.test_uid_20220803(`uid` Int32,`deviceId` String)ENGINE = ReplicatedMergeTree('/clickhouse/test/tables/{shard}/test_uid_20220803', '{replica}')PARTITION BY uidORDER BY uidSETTINGS index_granularity = 8192;# Test DataINSERT INTO test.test_uid_20220803SELECT 1, 'abcd';# logout tabledetach table test.test_uid_20220803;# Querying again will show that the table does not existSELECT count()FROM test.test_uid_20220803Received exception from server (version 21.3.15):Code: 60. DB::Exception: Received from 127.0.0.1:9000. DB::Exception: Table test.test_uid_20220803 doesn't exist.# Temporarily the table structure still exists, but it is hidden by ck and goes online againattach table test.test_uid_20220803;# delete tabledrop table test.test_uid_20220803;Reference documentation: clickhouse official documentation
边栏推荐
- 【技术笔记】树莓派4B开机流程整理(无显示器安装)
- RecyclerView 缓存与复用机制
- 下一代 AutoAI:从模型为中心,到数据为中心
- Boost library study notes (1) Installation and configuration
- NLP未来,路在何方?从学术前沿和业界热点谈起
- SRM Supplier Collaborative Management System Function Introduction
- 学习探索-给字体设置前景色
- codeforces每日5题(均1600)-第二十八天
- 华为云计算HCIE之oceanstor仿真器的安装教程
- C. LIS or Reverse LIS?
猜你喜欢

荣耀互联对外开放,赋能智能硬件合作伙伴,促进全场景生态产品融合

Fork/Join框架

吃透Chisel语言.32.Chisel进阶之硬件生成器(一)——Chisel中的参数化

如何让 JS 代码不可断点

知乎高赞:拼多多和国家电网,选哪个?

从云计算到函数计算

Digital-intelligent supply chain management system for chemical manufacturing industry: build a smart supply system and empower enterprises to improve production efficiency

对象实例化之后一定会存放在堆内存中?

Codeforces Round #811 (Div. 3)

集群监控——Zabbix使用
随机推荐
pyhon爬虫之爬取图片(亲测可用)
R语言计算时间序列数据的逐次差分(successive differences):使用diff函数计算时间序列数据的逐次差分值
【日记】UPNP功能会允许自动给光猫追加端口映射
arm交叉编译
C. LIS or Reverse LIS?
【技术笔记】let 和 var和const的异同
88.(cesium之家)cesium聚合图
下一代 AutoAI:从模型为中心,到数据为中心
Cholesterol-PEG-DBCO,CLS-PEG-DBCO,胆固醇-聚乙二醇-二苯基环辛炔科研试剂
如何模拟后台API调用场景,很细!
【日记】mysql基本操作
mmdetection/mmdetection3d多机多卡训练
为什么买域名必须实名认证?这样做什么原因?
Catering Supply Chain Management System
WPF 光标初始化的时候 temp 文件夹满了无法创建
codeforces每日5题(均1600)-第二十八天
树莓派温度监视关机保护脚本
OpenInfra Days China 2022|SelectDB与你共享 Apache Doris 在互联网广告业务中的实践
身为程序员的我们如何卷死别人?破局重生。
数字化金融企业的产品体系长啥样?