当前位置:网站首页>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
边栏推荐
- 面试官:可以谈谈乐观锁和悲观锁吗
- 开发一套高容错分布式系统
- 小程序学习目标
- R语言ggplot2可视化:使用ggpubr包的ggbarplot函数可视化柱状图、color参数指定柱状图的边框的色彩
- JSP 标准标签库(JSTL)[通俗易懂]
- 谷歌开发者社区推荐:《Jetpack Compose 从入门到实战》新书上架,带你踏上 Compose 开发之旅~
- CAS:474922-26-4,DSPE-PEG-NH2,DSPE-PEG-amine,磷脂-聚乙二醇-氨基供应
- PT100铂热电阻三种测温方法介绍
- 荣耀互联对外开放,赋能智能硬件合作伙伴,促进全场景生态产品融合
- R语言ggpubr包的ggline函数可视化折线图、设置add参数为mean_se和dotplot可视化不同水平均值的折线图并为折线图添加误差线(se标准误差)和点阵图、设置折线和数据点边框颜色
猜你喜欢

学习探索-给字体设置前景色

】 【 LeetCode daily one problem - 540. The order of a single element of the array

下一代 AutoAI:从模型为中心,到数据为中心

Liunx删除乱码文件

如何让 JS 代码不可断点

CAS:474922-26-4,DSPE-PEG-NH2,DSPE-PEG-amine,磷脂-聚乙二醇-氨基供应

西西成语接龙小助手

如何模拟后台API调用场景,很细!

【技术积累】JS事件循环,Promise,async/await的运行顺序

Cholesterol-PEG-DBCO,CLS-PEG-DBCO,胆固醇-聚乙二醇-二苯基环辛炔科研试剂
随机推荐
【LeetCode Daily Question】——374. Guess the size of the number
init和destory方法
《机器学习理论到应用》电子书免费下载
自定义组件,并在组件中注入自定义组件实现多种场景的下的组件切换
The second step through MySQL in four steps: MySQL index learning
mysqlbinlog 超过500g自动删除,保留7个,求大深给个版本
化学制品制造业数智化供应链管理系统:打造智慧供应体系,赋能企业产效提升
88. (the home of cesium) cesium polymerization figure
mmdetection/mmdetection3d多机多卡训练
【日记】UPNP功能会允许自动给光猫追加端口映射
框架整合(二)- 使用Apache ShardingSphere实现数据分片
区间贪心(区间合并)
【日记】nodejs构建API框架以及RESTful API 和 JSON-RPC的取舍
我的大一.
多线程学习笔记-3.并发容器
R语言ggpubr包的ggtexttable函数可视化表格数据(直接绘制表格图或者在图像中添加表格数据)、使用ggarrange函数将表格数据和可视化图像组合起来(表格数据在可视化图像下方)
餐饮供应链管理系统
小程序笔记2
mysql学习笔记——利用动态SQL和Session变量实现一个公式或者计算器
对象实例化之后一定会存放在堆内存中?