Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update workload document #1407

Closed
wants to merge 98 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
a665b9d
Update load-manual.md (#1339)
Ruffianjiang Nov 19, 2024
59ffabb
[Refactor](data-partition) Refactor data partition docs (#1364)
zclllyybb Nov 19, 2024
2b574c6
[download] Fix 2.0.15 download link (#1374)
KassieZ Nov 19, 2024
768e146
[docs](typo) Version mgt and fix typo (#1362)
KassieZ Nov 19, 2024
937309d
[Fix] Update remote-storage.md (#1247)
intelligentfu8 Nov 19, 2024
0c17c70
Update install-env.md (#1269)
wangtianyi2004 Nov 19, 2024
817edf4
Update install-env.md (#1270)
wangtianyi2004 Nov 19, 2024
592a5d6
[doc] fix dead link (#1317)
sdhzwc Nov 19, 2024
4d8c7c5
[doc] add datalake tutorial of lakesoul (#1320)
Ceng23333 Nov 19, 2024
b39204b
[Docs] Add doc for variant nested type (#1328)
eldenmoon Nov 19, 2024
5b18007
[blog](update) Update blog and fix typo (#1381)
KassieZ Nov 21, 2024
0d17212
[doc](refactor) update k8s install operator doc (#1369)
intelligentfu8 Nov 21, 2024
8abd63d
[doc](function) support table-function posexplode (#1283)
zhangstar333 Nov 21, 2024
71b86fe
[doc] fix link error of lakesoul tutorial (#1384)
Ceng23333 Nov 21, 2024
7cc3026
[doc](routine load) fix routine load doc error (#1382)
sollhui Nov 22, 2024
5a496a2
Removed useless workflow: deadlink checker (#1394)
yang1666204 Nov 23, 2024
e04f3ee
[community] Update announcement (#1398)
KassieZ Nov 23, 2024
b0e8dff
[fix] fix cron deploy1 (#1400)
KassieZ Nov 23, 2024
a07046f
Update:add event Doris Summit Asia 2024 (#1395)
yang1666204 Nov 25, 2024
99a2a9e
[doc](dbt)add dbt doc example (#1387)
catpineapple Nov 25, 2024
fea6ece
[doc](fixed) selectdb to apache (#1402)
intelligentfu8 Nov 25, 2024
6e7aee7
Update build-check.yml (#1401)
jeffreys-cat Nov 25, 2024
a1f4912
[fix] Update Doris Summit Asia (#1405)
KassieZ Nov 25, 2024
41a58e8
[mod] modify the announcement (#1406)
morningman Nov 25, 2024
1aa0683
Add restore_download_snapshot_batch_size/backup_upload_snapshot_batch…
w41ter Nov 27, 2024
8de4b3a
[blog] Update minimax blog and all release (#1414)
KassieZ Nov 27, 2024
b15ca03
[doc](udf) refactor the java-udf function doc (#1383)
zhangstar333 Nov 27, 2024
7b68672
[doc] add doc of `show backend config` (#1306)
DarvenDuan Nov 27, 2024
5623288
[Enhancement] replace table options to keep original dropped table in…
Vallishp Nov 27, 2024
7d9903a
[web]Update the version selection on the upgrade page (#1326)
yang1666204 Nov 27, 2024
14b6fac
Update high-concurrent-point-query.md (#1329)
wangtianyi2004 Nov 27, 2024
13b4769
[doc](percentile) update percentile/percentile_array doc as now suppo…
zhangstar333 Nov 27, 2024
be32821
[Chinese] update join hint (#1375)
LiBinfeng-01 Nov 28, 2024
c2bc502
[fix] Fix crondeploy by Java UDF Docs Format (#1418)
KassieZ Nov 28, 2024
8fe409f
[improvement] improve docs for ccr (#1419)
dataroaring Nov 28, 2024
55671ec
update row storage docs (#1413)
xiaokang Nov 28, 2024
cc975e0
[opt](show) update show collation sql reference manual (#1410)
morrySnow Nov 28, 2024
0295f70
[update] add collaborators (#1421)
KassieZ Nov 28, 2024
6d51f24
[doc] add trim_in function docs (#1207)
liujiwen-up Nov 28, 2024
1b812a6
Update quick-start.md (#1345)
Ruffianjiang Nov 28, 2024
ce70cda
增加端口规划,客户端需要8040的端口的网络连通。 (#1377)
zyszys-max Nov 28, 2024
ec83e9d
[improvement](ccr) improve overview of ccr (#1427)
dataroaring Dec 2, 2024
41055be
[doc](update) modify the example for UPDATE usage (#1412)
zhannngchen Dec 3, 2024
0380821
[doc]modify wrongly written character in release-2.1.4.md (#1432)
ixzc Dec 3, 2024
3504dc4
[Fix](CI) ignore markdown file suffix changes in deadlink check (#1447)
zclllyybb Dec 4, 2024
11f7c83
[release] Update 3.0.3 release note (#1451)
KassieZ Dec 4, 2024
8671466
[update] update banner link (#1456)
KassieZ Dec 5, 2024
a810f25
[Feature] Add map function docs which implemented for long (#1454)
zclllyybb Dec 5, 2024
d25cd71
[Enhancement](function) Add more detail explanation about approx_coun…
zclllyybb Dec 5, 2024
74de2f7
feat:docs (#1461)
yang1666204 Dec 5, 2024
a31ae20
fix:search load (#1462)
yang1666204 Dec 5, 2024
e15d32b
fix: fix resources url error (#1465)
KassieZ Dec 5, 2024
871a15b
[fix] fix the search cors error (#1466)
jeffreys-cat Dec 6, 2024
a3ed26c
fix: fix the searchbar version (#1467)
yang1666204 Dec 6, 2024
99e243a
fix:change searchbar version to 0.45 (#1468)
yang1666204 Dec 6, 2024
f9cd873
fix:fix search bar (#1469)
yang1666204 Dec 6, 2024
204f988
fix:request when switch version (#1470)
yang1666204 Dec 6, 2024
3949aa9
feat: remove pwa (#1471)
jeffreys-cat Dec 6, 2024
4ebf77d
K8s decoupled doc (#1415)
intelligentfu8 Dec 6, 2024
7c0524f
[improvement](cluster_id) provide a shell generating random cluster_i…
dataroaring Dec 6, 2024
5725a4b
Update what-is-apache-doris.md (#1472)
ssusieee Dec 6, 2024
3f08c80
[opt](encryption) update encryption function docs (#1463)
morrySnow Dec 6, 2024
4888d0c
[update](sql statement) Refactor sql statement of v3.0and v2.1 (#1449)
KassieZ Dec 6, 2024
7e50cc8
[fix] fix format and typo (#1474)
KassieZ Dec 6, 2024
320436c
fix:searchbar style (#1475)
yang1666204 Dec 9, 2024
53ff296
modify the request url of search (#1479)
yang1666204 Dec 9, 2024
cb24992
[fix] release 3.0.3 (#1480)
KassieZ Dec 9, 2024
88010f3
[update] Blog (#1481)
KassieZ Dec 9, 2024
96ddd58
add build check (#1483)
yang1666204 Dec 9, 2024
e2c4201
Update es.md (#1430)
jgq2008303393 Dec 9, 2024
3df0d0d
[auth]change default log level of ranger to warn (#1433)
zddr Dec 9, 2024
13936a4
[doc](update) rewrite update overview doc (#1393)
zhannngchen Dec 9, 2024
a02c784
[update] Update auth docs (#1485)
KassieZ Dec 9, 2024
5ddf2ef
[doc](delete) update the examples of batch delete to reference links …
zhannngchen Dec 10, 2024
fcc63fd
[doc] fix the wrong link in the tpch document (#1486)
tiger3q Dec 10, 2024
e2ae0ff
[doc]Support for IP types in Java UDF (#1444)
Mryange Dec 10, 2024
ee9f8ba
fix name SQL conflict error in point query docs (#1439)
xiaokang Dec 10, 2024
52e1d92
[opt](cte) indicate not support recursive cte (#1388)
morrySnow Dec 10, 2024
00d1873
update subquery document (#1422)
starocean999 Dec 10, 2024
6b30608
Fixed the issue where the search box request took too long (#1495)
yang1666204 Dec 10, 2024
a3bd665
[update] Add file_cache_statistics (#1496)
KassieZ Dec 11, 2024
2f79bbb
[Doc](benchmark) update 2.1 benchmark doc. (#1493)
feifeifeimoon Dec 11, 2024
d43cc31
[community] Add special thanks of community (#1502)
KassieZ Dec 11, 2024
a34d7b6
Update mysql-compatibility.md (#1498)
wm1581066 Dec 11, 2024
5f78d78
[update] Fix typo of MySQL Compatibility (#1504)
KassieZ Dec 11, 2024
fe75658
[Enhancement]:Optimize navbar (#1497)
yang1666204 Dec 11, 2024
107bc40
Remove common docs (#1501)
yang1666204 Dec 11, 2024
2983496
[opt](sql cache) Reorganize the chapter on SQL Cache (#1392)
morrySnow Dec 11, 2024
bd18304
[fix] Fix deadlink of complex data type (#1507)
KassieZ Dec 12, 2024
9b69d94
[fix] add the window-function doc and multi-dimensional-analytics doc…
feiniaofeiafei Dec 12, 2024
2fbf40f
fix:download page (#1514)
yang1666204 Dec 12, 2024
fcb4a82
[feat]:searchbar in mobile (#1517)
yang1666204 Dec 13, 2024
fa45f8c
[doc](update) update concurrent control (#1487)
zhannngchen Dec 16, 2024
43a077a
[doc](update) modify update-of-unique-model.md (#1438)
zhannngchen Dec 16, 2024
92aa6dc
Restore announcementBar (#1525)
yang1666204 Dec 16, 2024
66849d8
[refactor](k8s)K8s coupled refactor arch (#1500)
intelligentfu8 Dec 16, 2024
b2bb98c
[docs](load) restructure broker load docs (#1372)
kaijchen Dec 17, 2024
3a930f8
update workload document
wangbo Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[doc](update) rewrite update overview doc (#1393)
# Versions 

- [x] dev
- [x] 3.0
- [x] 2.1
- [x] 2.0

# Languages

- [x] Chinese
- [x] English
  • Loading branch information
zhannngchen authored Dec 9, 2024
commit 13936a420d6443551c23317d0151d7724306dc9d
81 changes: 46 additions & 35 deletions docs/data-operate/update/update-overview.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,33 @@ specific language governing permissions and limitations
under the License.
-->

数据更新,主要指针对相同 Key 的数据 Value 列的值的更新,这个更新对于主键模型来说,就是替换,对于聚合模型来说,就是如何完成针对 value 列上的聚合。
数据更新是指对具有相同 key 的数据记录中的 value 列进行修改。对于不同的数据模型,数据更新的处理方式有所不同:

- **主键(Unique)模型**:主键模型是专门为数据更新设计的一种数据模型。Doris 支持两种存储方式:Merge-on-Read(MoR)和 Merge-on-Write(MoW)。MoR 优化了写入性能,而 MoW 则提供了更好的分析性能。从 Doris 2.1 版本开始,默认存储方式为 MoW。主键模型支持使用 `UPDATE` 语句进行少量数据更新,也支持通过导入方式进行批量更新。导入方式包括 Stream Load、Broker Load、Routine Load 和 Insert Into 等,所有导入操作都遵循“UPSERT”语义,即如果记录不存在则插入,存在则更新。更新操作支持整行更新和部分列更新,默认为整行更新。

- **聚合(Aggregate)模型**:在聚合模型中,数据更新是一种特殊用法。当聚合函数设置为 REPLACE 或 REPLACE_IF_NOT_NULL 时,可以实现数据更新。聚合模型仅支持基于导入方式的更新,不支持使用 `UPDATE` 语句。通过设置聚合函数为 REPLACE_IF_NOT_NULL,可以实现部分列更新的能力。

通过对不同模型的数据更新方式的理解,可以更好地选择适合的更新策略,以满足具体的业务需求。

## 不同模型/实现的更新能力对比

### 性能对比
| | Unique Key MoW | Unique Key MoR | Aggregate Key |
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
| 导入速度 | 导入过程中进行数据去重,小批量实时写入相比 MoR 约有 10%-20% 的性能损失,大批量导入(例如千万级/亿级数据)相比 MoR 约有 30%-50% 的性能损失 | 与 Duplicate Key 接近 | 与 Duplicate Key 接近 |
| 查询速度 | 与 Duplicate Key 接近 | 需要在查询期间进行去重,查询耗时约为 MoW 的 3-10 倍 | 如果聚合函数为 REPLACE/REPLACE_IF_NOT_NULL,查询速度与 MoR 接近 |
| 谓词下推 | 支持 | 不支持 | 不支持 |
| 资源消耗 | - **导入资源消耗**:相比 Duplicate Key/Unique Key MoR,约额外消耗 10%-30% 的 CPU。<br /> - **查询资源消耗**:与 Duplicate Key 接近,无额外资源消耗。<br /> - **Compaction 资源消耗**:相比 Duplicate Key,消耗更多内存和 CPU,具体取决于数据特征和数据量。 | - **导入资源消耗**:与 Duplicate Key 相近,无额外资源消耗。<br /> - **查询资源消耗**:相比 Duplicate Key/Unique Key MoW,查询时额外消耗更多的 CPU 和内存。<br /> - **Compaction 资源消耗**:相比 Duplicate Key,需更多内存和 CPU,具体数值取决于数据特征和数据量。 | 与 Unique Key MoR 相同 |

### 功能支持对比
| | Unique Key MoW | Unique Key MoR | Aggregate Key |
|----------------|----------------|----------------|----------------|
| UPDATE | 支持 | 支持 | 不支持 |
| DELETE | 支持 | 支持 | 不支持 |
| sequence 列 | 支持 | 支持 | 不支持 |
| delete_sign | 支持 | 支持 | 不支持 |
| 部分列更新 | 支持 | 不支持 | 支持(但无法更新 null 值) |
| 倒排索引 | 支持 | 不支持 | 不支持 |

## 主键(Unique)模型的更新

Expand All @@ -35,14 +61,14 @@ Doris 主键 (unique) 模型,从 Doris 2.0 开始,除了原来的 Merge-on-R
```sql
CREATE TABLE IF NOT EXISTS example_tbl_unique_merge_on_write
(
`user_id` LARGEINT NOT NULL,
`username` VARCHAR(50) NOT NULL ,
`city` VARCHAR(20),
`age` SMALLINT,
`sex` TINYINT,
`phone` LARGEINT,
`address` VARCHAR(500),
`register_time` DATETIME
`user_id` LARGEINT NOT NULL,
`username` VARCHAR(50) NOT NULL ,
`city` VARCHAR(20),
`age` SMALLINT,
`sex` TINYINT,
`phone` LARGEINT,
`address` VARCHAR(500),
`register_time` DATETIME
)
UNIQUE KEY(`user_id`, `username`)
DISTRIBUTED BY HASH(`user_id`) BUCKETS 1
Expand All @@ -58,9 +84,9 @@ PROPERTIES (

### 主键模型的两种更新方式

#### 使用`UPDATE`语句更新
#### 使用 `UPDATE` 语句更新

无论是 MoR 还是 MoW,语义都是完成对指定列的更新。单次UPDATE的耗时会随着被更新的数据量的增加而增长
无论是 MoR 还是 MoW,语义都是完成对指定列的更新。单次 UPDATE 的耗时会随着被更新的数据量的增加而增长

#### 基于导入的批量更新

Expand All @@ -72,13 +98,13 @@ Doris 支持多种数据导入方式,包括 Stream Load、Broker Load、Routin

我们会分别在文档 [主键模型的 Update 更新](../update/unique-update) 和 [主键模型的导入更新](../update/update-of-unique-model) 详细介绍两种更新方式。

### 主键模型的更新事务
### 主键模型的更新并发控制

#### 使用`UPDATE`语句更新数据
#### 使用 `UPDATE` 语句更新数据

默认情况下,Doris 不允许在同一时间对同一张表进行多个`UPDATE`操作。`UPDATE`语句通过表级锁来确保事务的一致性
默认情况下,Doris 不允许在同一时间对同一张表进行多个 `UPDATE` 操作。`UPDATE` 语句通过表级锁来确保隔离性

用户可以通过修改 FE 配置`enable_concurrent_update=true`来调整并发限制。当放宽并发限制时,`UPDATE`语句将不再提供事务保证
用户可以通过修改 FE 配置 `enable_concurrent_update=true` 来调整并发限制。当放宽并发限制时,多个 `UPDATE` 语句如果更新同一行数据,结果将是未定义的

#### 基于导入的批量更新

Expand All @@ -88,32 +114,18 @@ Doris 对所有导入更新操作提供原子性保障,即每次导入数据

由于多个并发导入更新的提交顺序可能无法预期,若这些并发导入涉及相同主键的更新,则其生效顺序也无法预知,最终的可见结果会因此存在不确定性。为解决此问题,Doris 提供了 sequence 列机制,允许用户在并发导入更新时为每一行数据指定版本,以便明确控制并发更新的结果顺序,实现确定性。

我们将在文档[主键模型的更新事务](../update/unique-update-transaction.md) 中对事务机制进行详细介绍
我们将在文档 [主键模型的更新事务](../update/unique-update-transaction.md) 中对事务机制进行详细介绍

## 聚合(Aggregate)模型的更新

聚合模型的更新,主要是指的是用新的列值和旧的聚合值按照聚合函数的要求产出新的聚合值
聚合模型的更新,主要是指用新的列值和旧的聚合值按照聚合函数的要求产出新的聚合值

New Agg Value = Agg Func ( Old Agg Value, New Column Value)

聚合模型只支持基于导入方式的更新,不支持使用 Update 语句更新。在定义聚合模型表的时候,如果把 value 列的聚合函数定义为 REPLACE_IF_NULL,也可以间接实现类似主键表的部分列更新能力。更多内容,请查看 [聚合模型的导入更新](../update/update-of-aggregate-model)。

## 不同模型/实现的更新能力对比

### 性能对比
| | Unique Key MoW | Unique Key MoR | Aggregate Key |
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
| 导入速度 | 导入过程中进行数据去重,小批量实时写入相比MoR约有10%-20%的性能损失,大批量导入(例如千万级/亿级数据)相比MoR约有30%-50%的性能损失 | 与Duplicate Key接近 | 与Duplicate Key接近 |
| 查询速度 | 与Duplicate Key接近 | 需要在查询期间进行去重,查询耗时约为 MoW 的3-10倍 | 如果聚合函数为REPLACE/REPLACE_IF_NOT_NULL,查询速度与MoR接近 |
| 谓词下推 | 支持 | 不支持 | 不支持 |
| 资源消耗 | - **导入资源消耗**:相比Duplicate Key/Unique Key MoR,约额外消耗约10%-30%的CPU。<br /> - **查询资源消耗**:与Duplicate Key接近,无额外资源消耗。<br /> - **Compaction资源消耗**:相比Duplicate Key,消耗更多内存和CPU,具体取决于数据特征和数据量。 | - **导入资源消耗**:与Duplicate Key相近,无额外资源消耗。<br /> - **查询资源消耗**:相比Duplicate Key/Unique Key MoW,查询时额外消耗更多的CPU和内存。<br /> - **Compaction资源消耗**:相比Duplicate Key,需更多内存和CPU,具体数值取决于数据特征和数据量。 | 与Unique Key MoR相同 |
聚合模型只支持基于导入方式的更新,不支持使用 Update 语句更新。在定义聚合模型表的时候,如果把 value 列的聚合函数定义为 REPLACE_IF_NOT_NULL,也可以间接实现类似主键表的部分列更新能力。更多内容,请查看 [聚合模型的导入更新](../update/update-of-aggregate-model)。

### 功能支持对比
| | Unique Key MoW | Unique Key MoR | Aggregate Key |
|----------------|----------------|----------------|----------------|
| UPDATE |支持|支持| 不支持 |
| DELETE |支持|支持| 不支持 |
| sequence列 |支持|支持| 不支持 |
| delete_sign |支持|支持| 不支持 |
| 部分列更新 |支持|不支持| 支持(但无法更新null值) |
| 倒排索引 |支持|不支持| 不支持 |
## 主键模型和聚合模型的选择建议
- 大部分有数据更新需求的场景,都建议**首选主键模型**。例如从 TP 数据库 CDC 同步到 Doris,用户画像,人群圈选等。
- 下面两类场景,建议使用聚合模型:
1. 部分字段需要做指标聚合,部分字段需要进行更新。
2. 对部分列更新有需求,同时对写入性能非常敏感,对查询延迟要求不高的场景,建议使用聚合表 + REPLACE_IF_NOT_NULL 聚合函数。
Loading