环境
- 环境搭建参考之前写过的文章CentOS7 安装 Gauss DB 200 单节点
- Data Studio 6.5.使用参考之前写的文章Gauss DB 数据库使用(二) Data Studio
server端说明 | 描述 |
---|---|
服务器 | 华为泰山 2280 v2 |
操作系统 | Cent OS 7.6 aarch64 |
数据库版本 | GaussDB_200_6.5.1_RHEL_ARM64 |
cline说明 | 描述 |
---|---|
测试机 | PC【CPU*8 内存*16G 硬盘*512G(ssd)】 |
操作系统 | win10 |
测试工具 | Data Studio 6.5.1 |
场景 - 大表JOIN统计查询 (OLAP)
背景
outer join 是我们在业务中最常使用的查询格式之一,尤其在OLAP类型的系统中,更是会经常出现大数据量多个数据outer join来做统计汇总,因此一款数据库能否高效支撑大表outer join是衡量是否有效支撑OLAP业务的重要指标
设计
两张表,A表100W数据,B表1000W数据。B表中包含A中的80W条数据。
测试用例:
- A表中包含B表中数据条数
- A表中不包含B表中数据条数
- B表中包含A表中数据条数
- B表中不包含A表中数据条数
1用户并发,连续查询100次。
准备
- 创建测试表
drop table if exists t_test06_01;
drop table if exists t_test06_02;
create table t_test06_01 (
id serial,
info text default 'sfsluiejldksjfslaueijflsdjflsjfleifeiolfjsl'::text,
state integer default 0,
create_time timestamp without time zone default now(),
modify_time timestamp without time zone default now()
)
with (orientation=row, compression=no)
DISTRIBUTE BY HASH(id)
TO GROUP group_version1;
alter table t_test06_01 add CONSTRAINT t_test06_01_pkey primary key (id);
create table t_test06_02 (like t_test06_01 including all);
-- 准备测试数据
insert into t_test06_01(id) select id from generate_series(1,1000000) t(id);
insert into t_test06_02(id) select 200000+id from generate_series(1,10000000) t(id);
- 测试语句
select count(1)
from t_test06_01 a
left join t_test06_02 b on b.id = a.id
where b.id is null;
select count(1)
from t_test06_01 a
left join t_test06_02 b on b.id = a.id
where b.id is not null;
select count(1)
from t_test06_02 b
left join t_test06_01 a on a.id = b.id
where a.id is null;
select count(1)
from t_test06_02 b
left join t_test06_01 a on a.id = b.id
where a.id is not null;
配置jmeter
-
创建Thread Group
-
创建jdbc连接
-
创建JDBC Request
A表中不包含B表中数据条数
A表中包含B表中数据条数
B表中不包含A表中数据条数
B表中包含A表中数据条数
-
添加结果监控
测试结果

-
如上图,从JMeter的监控看,总体运行稳定,排除测试工具性能瓶颈影响测试结果的可能性。
-
如上图,在测试期间,数据库资源使用情况明显增加,但是总体运行稳定,压力没有达到数据库性能瓶颈。
从上图测试结果来看,“A表中不包含B表中数据条数”,响应速度最快,大概在800ms左右;“B表中不包含A表中数据条数”,响应速度最慢,左右在1s左右;剩余两项测试响应时间大概在900ms左右;四项测试响应时间基本都不超过1s,基本满足业务需求。
网友评论