doris数据模型,07-Duplicate模型

2023-12-27 00:14:32

概念

Duplicate Key模型,导入数据时不会产生聚合,源数据不失真。
被指定为Duplicate Key的字段用来指示底层数据按照该字段排序

如:对于日志分析,不在意多几条,少几条数据,只关心排序,这时候Duplicate Key模型就有用武之地了。

create table if not exists test_db.example_log
(
	`log_time` datetime not null comment "日志时间",
	`type` int not null comment "日志类型",
	`error_code` int comment "错误码",
	`error_msg` varchar(1024) comment "错误详细信息",
	`op_id` bigint comment "负责人id",
	`op_time` datetime comment "处理时间" 
)
duplicate key (`log_time`, `type`)
distributed by hash(`log_time`) buckets 10;

特点

  1. 适用于数据即没有主键,也没有聚合需求的场景
  2. 虽然不能使用预聚合功能,但是,可以发挥列存储模型的优势,只读取相关列,不需要读取所有字段的列。

文章来源:https://blog.csdn.net/cin_ie/article/details/135232900
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。