This commit is contained in:
2021-11-14 14:32:08 +08:00
parent f75ad8bedd
commit b0f6120151
152 changed files with 22219 additions and 8 deletions

39
content/post/ch-buffer.md Normal file
View File

@@ -0,0 +1,39 @@
---
title: "ClickHouse 表引擎之 Buffer"
date: 2020-10-08T18:08:00+08:00
lastmod: 2020-10-08T18:08:00+08:00
tags: []
categories: ["clickhouse"]
---
# Buffer 表引擎简介
- 只写内存,无持久化存储
- 缓冲高并发写入满足条件时Buffer 表会把数据刷新到目标表
# 创建 Join 引擎表
- 声明
```sql
ENGINE = Buffer(
database,
table,
num_layers,
min_time,
max_time,
min_rows,
max_rows,
min_bytes,
max_bytes
)
```
- database: 目标表所在数据库
- table: 目标表名
- num_layers: 刷新数据到目标表时开启的线程数,官方建议 16
- min_time 和 max_time: 时间条件,单位秒
- min_rows 和 max_rows: 数据行数条件
- min_bytes 和 max_bytes: 数据体量条件,单位字节
- 所有最小阈值都满足时,触发刷新
- 至少一个最大阈值满足时,触发刷新
- 如果一批数据的行数大于 max_rows或体量大于 max_bytes则数据直接写入目标表
- 各线程(num_layers)单独计算刷新规则