diff --git a/product/zh/docs-mogdb/v1.1.0/poc/poc-jiangsumobile.assets/image-20210312105303222.png b/product/zh/docs-mogdb/v1.1.0/poc/poc-jiangsumobile.assets/image-20210312105303222.png deleted file mode 100644 index 616e33e610b0bca7f20fbef6bea75996c69b2d46..0000000000000000000000000000000000000000 Binary files a/product/zh/docs-mogdb/v1.1.0/poc/poc-jiangsumobile.assets/image-20210312105303222.png and /dev/null differ diff --git a/product/zh/docs-mogdb/v1.1.0/poc/poc-jiangsumobile.assets/image-20210312105352146.png b/product/zh/docs-mogdb/v1.1.0/poc/poc-jiangsumobile.assets/image-20210312105352146.png deleted file mode 100644 index 7d8d8d38fe5770b45b9a0b17ef3a9208d55d9133..0000000000000000000000000000000000000000 Binary files a/product/zh/docs-mogdb/v1.1.0/poc/poc-jiangsumobile.assets/image-20210312105352146.png and /dev/null differ diff --git a/product/zh/docs-mogdb/v1.1.0/poc/poc-jiangsumobile.md b/product/zh/docs-mogdb/v1.1.0/poc/poc-jiangsumobile.md deleted file mode 100644 index 7e82f6e41eb282efc3dc4ad7637a375ba2ca4dc1..0000000000000000000000000000000000000000 --- a/product/zh/docs-mogdb/v1.1.0/poc/poc-jiangsumobile.md +++ /dev/null @@ -1,1618 +0,0 @@ -# 某省移动MogDB1.1.0版本测试报告 - -## POC前准备工作 - -### 操作系统版本及下载地址 - -| 介质名称 | 介质大小 | 最后更新时间 | -| ------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------- | -| [openEuler-20.03-LTS-aarch64-dvd.iso](https://repo.openeuler.org/openEuler-20.03-LTS/ISO/aarch64/openEuler-20.03-LTS-aarch64-dvd.iso) | 4.3 GiB | 2020-Mar-26 14:46 | - -#### 用户名和组 - -| 组名 | 组ID | 用途 | -| --------- | -------- | ------------- | -| root | 0 | administrator | -| bomc | 1302 | 网管 | -| osmgr | 1800 | OS管理 | -| xtjgmons | 5000 | 系统维护 | -| ==dbgrp== | ==5002== | ==MogDB== | - -| 用户名 | 用户ID | 所属用户组 | Home目录 | Shell | 用途 | -| -------- | -------- | ---------- | ------------- | --------- | ----------------- | -| root | 0 | root | /root | /bin/bash | administrator | -| toptea | 1302 | bomc | /toptea | /bin/bash | 网管 | -| osmgr | 1800 | osmgr | /home/osmgr | /bin/bash | OS管理 | -| dutyview | 5000 | xtjgmons | 5000 | 无 | 无 | -| dutywath | 5001 | xtjgmons | 5000 | 无 | 无 | -| ==omm== | ==5002== | ==dbgrp== | ====/home/omm | 无 | ==MogDB==系统用户 | - -### 本地盘划分 - -| lv卷名 | 文件系统 | 大小 | 属组 | 权限 | 系统格式 | 用途 | -| ------------------ | ---------- | ---- | ----- | ---- | -------- | -------------------------------------------------------- | -| vg_og/lv_ogdata | /ogdata | 2T | dbgrp | 755 | ext4 | datapath 存放数据文件 | -| vg_og/lv_ogxlog | /ogxlog | 500G | dbgrp | 755 | ext4 | 存放redo日志 | -| vg_og/lv_ogarchive | /ogarchive | 1T | dbgrp | 755 | ext4 | 存放归档日志 | -| rootvg | /mogdb | 200G | dbgrp | 755 | ext4 | 存放数据库二进制、日志、临时文件、socket文件、om维护命令 | -| vg_og/lv_ogbackup | /og_bak | 6T | dbgrp | 755 | ext4 | 存放数据备份 | - -## 服务器配置 - -| 机房位置 | 机架位置 | 设备数量 | 设备型号 | -| ------------ | --------- | -------- | ------------ | -| 浦口高新机房 | C11(2台) | 2 | 华为100 T130 | - -| 型号 | CPU | 内存 | 硬盘 | 数量 | -| ----------- | ------------------ | ---- | --------------------------------------------------------- | ---- | -| 华为100 T30 | 鲲鹏920 (48core)*2 | 384G | OS盘: 2块600G SAS RAID1
数据盘: 6块3.2T SSD RAID5 | 2台 | - -## IP地址 - -| 设备 | 主机名 | 主机型号 | 机柜 | 管理地址 | 业务地址 | -| ---- | -------- | ------------ | ---- | ------------- | ------------- | -| 华为 | npromgs3 | 华为100 T130 | C11 | 190.168.80.79 | 10.32.225.150 | -| 华为 | npromgs4 | 华为100 T130 | C11 | 190.168.80.80 | 10.32.225.151 | - -## 操作系统版本 - -``` -openEuler 20.3LTS -## -``` - -## 数据库信息 - -### 数据库版本 - -``` -gsql ((MogDB 1.1.0 build 5be05d82) compiled at 2021-01-06 17:23:14 commit 0 last mr ) -``` - -### 数据库主备信息 - -| 主库 | IP: 10.32.225.150 | 读写 | -| ---- | ----------------- | ---- | -| 备库 | IP: 10.32.225.151 | 只读 | - -## 测试结果所在目录 - -### IP: 10.32.225.150 - -| 测试项 | 目录 | -| -------------- | ---------------------------------- | -| 测试用例及日志 | /og_bak | -| TPCC测试及日志 | /root/benchmarksql-5.0/run/tpcclog | - -## 功能测试 - -### 兼容性 - -| 测试项 | 测试结果 | 说明 | -| --------------- | -------- | -------------------------------------------------------------------------------------------------------------- | -| 数据类型 | 通过 | 对于数值类型 字符类型 二进制类型 日期类型 布尔类型 时间间隔类型 数组类型 json类型等常用数据类型支持情况。 | -| 字符集 | 通过 | 支持utf-8(MySQL中应为utf8mb4),gbk等常见字符格式类型 | -| 基本SQL语法 | 通过 | 增删改查操作 | -| 复杂SQL | 通过 | 多种连接查询,包括交叉连接、自然连接、jion…using、jion..on、自连接、内连接、外连接 | -| 常用函数 | 通过 | union、union all、intersect等集合操作符 | -| 操作符 | 通过 | 逻辑操作符and or not | -| SQL语法及兼容性 | 通过 | commit/rollback/grant等DCL操作 | -| 其他高级SQL兼容 | 通过 | on duplicate key update、WITH RECURSIVE(start with … connect、with as、lock table、create table if not exists | -| 数据分区 | 通过 | 测试范围分区: 支持增加、拆分、合并、交换、删除分区 | -| 索引管理 | 通过 | 创建表并创建普通索引 | -| 约束 | 通过 | 创建表并创建约束 | -| 事务一致性 | 通过 | 原子性、一致性、隔离性、持久性特性 | -| mvcc | 通过 | 写之间不阻塞。SELECT是纯读操作,UPDATE和DELETE是读写操作。 | -| mot | 通过 | 内存表 | - -### 优化器 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ----------------------------- | -| 执行计划解析 | 通过 | 能够显式展现SQL语句的执行计划 | -| hint | 通过 | 能够支持加hint | -| 查询转换 | 通过 | 支持查询转换 | - -### 高级功能 - -| 测试项 | 测试结果 | 说明 | -| -------- | -------- | ---------------------------------------- | -| 存储过程 | 通过 | 测试存储过程的基本功能和过程中的控制语句 | -| 函数 | 通过 | 测试存储函数的创建和删除操作 | -| 视图 | 通过 | 支持视图建立、修改、删除 | -| 游标 | 通过 | 测试定义并使用引用游标 | -| 触发器 | 通过 | 测试insert/update/delete/instead of | -| 序列 | 通过 | 创建并使用序列、获取序列当前值和下一值 | - -## 安全性测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ------------------------------------------------------------ | -| 用户权限管理 | 通过 | 权限管理 | -| 角色权限管理 | 通过 | 角色管理 | -| 身份鉴别 | 通过 | 配置密码复杂度检查,密码的不可重用天数,帐户登录失败尝试次数 | -| 审计日志 | 通过 | 记录用户登录退出的审计日志 | - -## 高可用测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ---------------------------------------------------- | -| 读写分离 | 通过 | 主库建测试表,备库去读取内容 | -| 保护模式配置 | 通过 | 通过参数控制保护模式,同步模式(同步,异步,半同步) | - -## 备份恢复测试 - -| 测试项 | 测试结果 | 说明 | -| ---------------------- | -------- | -------------------------------------------------------------------------------- | -| 物理备份全量备份和恢复 | 通过 | 主库建测试表,备库去读取内容 | -| 逻辑备份和恢复 | 通过 | 是否支持在线逻辑备份,验证备份后数据恢复正确性和效率,在线备份期间对性能的影响。 | - -## 运维管理测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | --------------------------------------------------------------------------- | -| 报错信息 | 通过 | [errorcode](https://support.huaweicloud.com/errorcode-dws/dws_08_0001.html) | -| 性能视图 | 通过 | 和数据库相关的性能视图 | -| 性能分析报告 | 通过 | WDR类似Oracle AWR | -| 慢SQL视图 | 通过 | | -| 日志管理 | 通过 | 系统日志,操作日志,Trace日志,黑匣子日志,审计日志,WAL日志,性能日志。 | -| 监控运维 | 通过 | 常用的运维和定位问题手段 | - -## 性能测试 - -### TPCC - -#### 测试工具BenchmarkSQL v5.0及参数 - -| 序号 | 参数名称 | 值 | -| ---- | ---------- | -------------------------------------------- | -| 1 | db | postgres | -| 2 | driver | org.postgresql.Driver | -| 3 | conn | jdbc:postgresql://10.32.225.150:6432/tpcctst | -| 4 | user | tpccuser | -| 5 | warehouses | 10000 | - -> 说明:数据总容量大约100GB - -#### 测试用表的数据量 - -| 序号 | 表名 | 数据总数 | -| ---- | ---------------- | -------------------- | -| 1 | bmsql_config | 4 | -| 2 | bmsql_custome | 30014788 | -| 3 | bmsql_district | 10000 | -| 4 | bmsql_history | 29996623 | -| 5 | bmsql_item | 100000 | -| 6 | bmsql_new_order | 9000105 | -| 7 | bmsql_oorder | 29995891 | -| 8 | bmsql_order_line | 299981583(约1.9亿) | -| 9 | bmsql_stock | 100002396(约1亿) | -| 10 | bmsql_warehouse | 1000 | - -#### 测试结果 - -| 并发 | 时长(分钟) | tpmC (NewOrders) | -| ---- | ------------ | ------------------ | -| 400 | 1 | 383010.44 | -| 400 | 2 | 396593.65 | -| 400 | 5 | 366825.72 | -| 400 | 10 | 369191.96 | - -### TPCH - -#### 测试用表的数据量 - -##### 工具导入3GB数据 - -![image-20210312105303222](https://cdn-mogdb.enmotech.com/docs-media/111.png) - -##### 工具导入 TPC-H 30G 数据 - -![image-20210312105352146](https://cdn-mogdb.enmotech.com/docs-media/115.png) - -#### 测试结果 - -| 查询语句说明 | Query ID | 3GB数据 | 30GB数据 | -| ------------------------------------------------ | -------- | ------------ | ------------- | -| 价格统计报告查询 | Q1 | 86290.621 ms | 867229.922 ms | -| 最小代价供货商查询 | Q2 | 1588.686 ms | 29948.139 ms | -| 运送优先级查询 | Q3 | 9930.242 ms | 153179.243 ms | -| 订单优先级查询 | Q4 | 2413.140 ms | 29535.320 ms | -| 某地区供货商为公司带来的收入查询 | Q5 | 12687.063 ms | 146917.921 ms | -| 预测收入变化查询 | Q6 | 3381.666 ms | 77716.338 ms | -| 货运盈利情况查询 | Q7 | 6423.072 ms | 142928.852 ms | -| 国家市场份额查询 | Q8 | 7985.378 ms | 103726.748 ms | -| 产品类型利润估量查询 | Q9 | 28462.979 ms | 366562.292 ms | -| 货运存在问题的查询 | Q10 | 10098.798 ms | 149445.271 ms | -| 库存价值查询 | Q11 | 1915.023 ms | 23855.269 ms | -| 货运模式和订单优先级查询 | Q12 | 11048.061 ms | 119823.533 ms | -| 消费者订单数量查询 | Q13 | 9149.003 ms | 116618.514 ms | -| 促销效果查询 | Q14 | 1024.503 ms | 29369.667 ms | -| 查询获得某段时间内为总收入贡献最多的供货商的信息 | Q15 | 3011.973 ms | 101147.519 ms | -| 零件/供货商关系查询 | Q16 | 2253.134 ms | 28748.335 ms | -| 小订单收入查询 | Q17 | 35671.622 ms | 420488.742 ms | -| 大订单顾客查询 | Q18 | 30810.445 ms | 461710.335 ms | -| 折扣收入查询 | Q19 | 10483.329 ms | 107313.130 ms | -| 供货商竞争力查询 | Q20 | 7903.905 ms | 161276.226 ms | -| 不能按时交货供货商查询 | Q21 | 20424.039 ms | 264827.982 ms | -| 全球销售机会查询 | Q22 | 3458.196 ms | 50860.840 ms | - -#### TPCH测试SQL - -##### Q1 - -``` -select - - l_returnflag, - - l_linestatus, - - sum(l_quantity) as sum_qty, - - sum(l_extendedprice) as sum_base_price, - - sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, - - sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, - - avg(l_quantity) as avg_qty, - - avg(l_extendedprice) as avg_price, - - avg(l_discount) as avg_disc, - - count(*) as count_order - -from - - lineitem - -where - - l_shipdate <= date '1998-12-01' - interval '103' day - -group by - - l_returnflag, - - l_linestatus - -order by - - l_returnflag, - - l_linestatus - -LIMIT 1; -``` - -##### Q2 - -``` -select - - s_acctbal, - - s_name, - - n_name, - - p_partkey, - - p_mfgr, - - s_address, - - s_phone, - - s_comment - -from - - part, - - supplier, - - partsupp, - - nation, - - region, - - ( - -​ select - -​ ps_partkey, - -​ min(ps_supplycost) as min - -​ from - -​ partsupp, - -​ supplier, - -​ nation, - -​ region - -​ where - -​ s_suppkey = ps_suppkey - -​ and s_nationkey = n_nationkey - -​ and n_regionkey = r_regionkey - -​ and r_name = 'EUROPE' - -​ group by - -​ ps_partkey - - ) temp - -where - - p_partkey = partsupp.ps_partkey - - and s_suppkey = ps_suppkey - - and p_size = 47 - - and p_type like '%BRASS' - - and s_nationkey = n_nationkey - - and n_regionkey = r_regionkey - - and r_name = 'EUROPE' - - and ps_supplycost = temp.min - - and p_partkey = temp.ps_partkey - -order by - - s_acctbal desc, - - n_name, - - s_name, - - p_partkey - -LIMIT 100; -``` - -#### Q3 - -``` -select - - l_orderkey, - - sum(l_extendedprice * (1 - l_discount)) as revenue, - - o_orderdate, - - o_shippriority - -from - - customer, - - orders, - - lineitem - -where - - c_mktsegment = 'BUILDING' - - and c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and o_orderdate < date '1995-03-20' - - and l_shipdate > date '1995-03-20' - -group by - - l_orderkey, - - o_orderdate, - - o_shippriority - -order by - - revenue desc, - - o_orderdate - -LIMIT 10; -``` - -##### Q4 - -``` -select - - o_orderpriority, - - count(*) as order_count - -from - - orders - -where - - o_orderdate >= date '1995-12-01' - - and o_orderdate < date '1995-12-01' + interval '3' month - - and exists - - ( - -​ select - -​ * - -​ from - -​ lineitem - -​ where - -​ l_orderkey = o_orderkey - -​ and l_commitdate < l_receiptdate - -​ limit 1 - - ) - -group by - - o_orderpriority - -order by - - o_orderpriority - -LIMIT 1; -``` - -##### Q5 - -``` -select - - n_name, - - sum(l_extendedprice * (1 - l_discount)) as revenue - -from - - customer, - - orders, - - lineitem, - - supplier, - - nation, - - region - -where - - c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and l_suppkey = s_suppkey - - and c_nationkey = s_nationkey - - and s_nationkey = n_nationkey - - and n_regionkey = r_regionkey - - and r_name = 'AMERICA' - - and o_orderdate >= date '1997-01-01' - - and o_orderdate < date '1997-01-01' + interval '1' year - -group by - - n_name - -order by - - revenue desc - -LIMIT 1; -``` - -##### Q6 - -``` -select - - sum(l_extendedprice * l_discount) as revenue - -from - - lineitem - -where - - l_shipdate >= date '1997-01-01' - - and l_shipdate < date '1997-01-01' + interval '1' year - - and l_discount between 0.07 - 0.01 and 0.07 + 0.01 - - and l_quantity < 24 - -LIMIT 1; -``` - -##### Q7 - -``` -select - - supp_nation, - - cust_nation, - - l_year, - - sum(volume) as revenue - -from - -( - - select - -​ n1.n_name as supp_nation, - -​ n2.n_name as cust_nation, - -​ extract(year from l_shipdate) as l_year, - -​ l_extendedprice * (1 - l_discount) as volume - - from - -​ supplier, - -​ lineitem, - -​ orders, - -​ customer, - -​ nation n1, - -​ nation n2 - - where - -​ s_suppkey = l_suppkey - -​ and o_orderkey = l_orderkey - -​ and c_custkey = o_custkey - -​ and s_nationkey = n1.n_nationkey - -​ and c_nationkey = n2.n_nationkey - -​ and - -​ ( - -​ (n1.n_name = 'CHINA' and n2.n_name = 'INDONESIA') - -​ or (n1.n_name = 'INDONESIA' and n2.n_name = 'CHINA') - -​ ) - -​ and l_shipdate between date '1995-01-01' and date '1996-12-31' - -) as shipping - -group by - - supp_nation, - - cust_nation, - - l_year - -order by - - supp_nation, - - cust_nation, - - l_year - -LIMIT 1; -``` - -##### Q8 - -``` -select - - o_year, - - sum(case - - when nation = 'INDONESIA' then volume - - else 0 - - end) / sum(volume) as mkt_share - -from - -( - - select - -​ extract(year from o_orderdate) as o_year, - -​ l_extendedprice * (1 - l_discount) as volume, - -​ n2.n_name as nation - -​ from - -​ part, - -​ supplier, - -​ lineitem, - -​ orders, - -​ customer, - -​ nation n1, - -​ nation n2, - -​ region - - where - -​ p_partkey = l_partkey - -​ and s_suppkey = l_suppkey - -​ and l_orderkey = o_orderkey - -​ and o_custkey = c_custkey - -​ and c_nationkey = n1.n_nationkey - -​ and n1.n_regionkey = r_regionkey - -​ and r_name = 'ASIA' - -​ and s_nationkey = n2.n_nationkey - -​ and o_orderdate between date '1995-01-01' and date '1996-12-31' - -​ and p_type = 'PROMO POLISHED TIN' - -) as all_nations - -group by - - o_year - -order by - - o_year - -LIMIT 1; -``` - -##### Q9 - -``` -select - - nation, - - o_year, - - sum(amount) as sum_profit - -from - -( - - select - -​ n_name as nation, - -​ extract(year from o_orderdate) as o_year, - -​ l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount - - from - -​ part, - -​ supplier, - -​ lineitem, - -​ partsupp, - -​ orders, - -​ nation - - where - -​ s_suppkey = l_suppkey - -​ and ps_suppkey = l_suppkey - -​ and ps_partkey = l_partkey - -​ and p_partkey = l_partkey - -​ and o_orderkey = l_orderkey - -​ and s_nationkey = n_nationkey - -​ and p_name like '%thistle%' - -) as profit - -group by - - nation, - - o_year - -order by - - nation, - - o_year desc - -LIMIT 1; -``` - -##### Q10 - -``` -select - - c_custkey, - - c_name, - - sum(l_extendedprice * (1 - l_discount)) as revenue, - - c_acctbal, - - n_name, - - c_address, - - c_phone, - - c_comment - -from - - customer, - - orders, - - lineitem, - - nation - -where - - c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and o_orderdate >= date '1994-06-01' - - and o_orderdate < date '1994-06-01' + interval '3' month - - and l_returnflag = 'R' - - and c_nationkey = n_nationkey - -group by - - c_custkey, - - c_name, - - c_acctbal, - - c_phone, - - n_name, - - c_address, - - c_comment - -order by - - revenue desc - -LIMIT 20; -``` - -##### Q11 - -``` -select - - ps_partkey, - - sum(ps_supplycost * ps_availqty) as value - -from - - partsupp, - - supplier, - - nation - -where - - ps_suppkey = s_suppkey - - and s_nationkey = n_nationkey - - and n_name = 'ALGERIA' - -group by - - ps_partkey having - - sum(ps_supplycost * ps_availqty) > - - ( - -​ select - -​ sum(ps_supplycost * ps_availqty) * 0.0001000000 - -​ from - -​ partsupp, - -​ supplier, - -​ nation - -​ where - -​ ps_suppkey = s_suppkey - -​ and s_nationkey = n_nationkey - -​ and n_name = 'ALGERIA' - - ) - -order by - - value desc - -LIMIT 1; -``` - -##### Q12 - -``` -select - - l_shipmode, - - sum(case when o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' then 1 else 0 end) as high_line_count, - - sum(case when o_orderpriority <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end) as low_line_count - -from - - orders, - - lineitem - -where - - o_orderkey = l_orderkey - - and l_shipmode in ('RAIL', 'SHIP') - - and l_commitdate < l_receiptdate - - and l_shipdate < l_commitdate - - and l_receiptdate >= date '1994-01-01' - - and l_receiptdate < date '1994-01-01' + interval '1' year - -group by - - l_shipmode - -order by - - l_shipmode - -LIMIT 1; -``` - -##### Q13 - -``` -select - - c_count, - - count(*) as custdist - -from - -( - - select - -​ c_custkey, - -​ count(o_orderkey) - - from - -​ customer left outer join orders on - -​ c_custkey = o_custkey - -​ and o_comment not like '%express%packages%' - - group by - -​ c_custkey - -) as c_orders (c_custkey, c_count) - -group by - - c_count - -order by - - custdist desc, - - c_count desc - -LIMIT 1; -``` - -##### Q14 - -``` -select - - 100.00 * sum(case when p_type like 'PROMO%' then l_extendedprice * (1 - l_discount) else 0 end) /sum(l_extendedprice * (1 - l_discount)) as promo_revenue - -from - - lineitem, - - part - -where - - l_partkey = p_partkey - - and l_shipdate >= date '1994-02-01' - - and l_shipdate < date '1994-02-01' + interval '1' month - -LIMIT 1; -``` - -##### 用到的视图 - -``` -create or replace view revenue0 (supplier_no, total_revenue) as - -select - - l_suppkey, - - sum(l_extendedprice * (1 - l_discount)) - -from - - lineitem - -where - - l_shipdate >= date '1994-02-01' - - and l_shipdate < date '1994-02-01' + interval '3' month - -group by - - l_suppkey; -``` - -##### Q15 - -``` -select - - s_suppkey, - - s_name, - - s_address, - - s_phone, - - total_revenue - -from - - supplier, - - revenue0 - -where - - s_suppkey = supplier_no - - and total_revenue = - - ( - -​ select - -​ max(total_revenue) - -​ from - -​ revenue0 - - ) - -order by - - s_suppkey - -LIMIT 1; -``` - -##### Q16 - -``` -select - - p_brand, - - p_type, - - p_size, - - count(distinct ps_suppkey) as supplier_cnt - -from - - partsupp, - - part - -where - - p_partkey = ps_partkey - - and p_brand <> 'Brand#55' - - and p_type not like 'MEDIUM PLATED%' - - and p_size in (35, 17, 43, 49, 19, 41, 30, 47) - - and ps_suppkey not in - - ( - -​ select - -​ s_suppkey - -​ from - -​ supplier - -​ where - -​ s_comment like '%Customer%Complaints%' - - ) - -group by - - p_brand, - - p_type, - - p_size - -order by - - supplier_cnt desc, - - p_brand, - - p_type, - - p_size - -LIMIT 1; -``` - -##### Q17 - -``` -select - - sum(l_extendedprice) / 7.0 as avg_yearly - -from - - lineitem, - - part, - - (SELECT l_partkey AS agg_partkey, 0.2 * avg(l_quantity) AS avg_quantity FROM lineitem GROUP BY l_partkey) part_agg - -where - - p_partkey = l_partkey - - and agg_partkey = l_partkey - - and p_brand = 'Brand#53' - - and p_container = 'JUMBO JAR' - - and l_quantity < avg_quantity - -LIMIT 1; -``` - -#### Q18 - -``` -select - - c_name, - - c_custkey, - - o_orderkey, - - o_orderdate, - - o_totalprice, - - sum(l_quantity) - -from - - customer, - - orders, - - lineitem - -where - - o_orderkey in - - ( - -​ select - -​ l_orderkey - -​ from - -​ lineitem - -​ group by - -​ l_orderkey having - -​ sum(l_quantity) > 313 - - ) - - and c_custkey = o_custkey - - and o_orderkey = l_orderkey - -group by - - c_name, - - c_custkey, - - o_orderkey, - - o_orderdate, - - o_totalprice - -order by - - o_totalprice desc, - - o_orderdate - -LIMIT 100; -``` - -##### Q19 - -``` -select - - sum(l_extendedprice* (1 - l_discount)) as revenue - -from - - lineitem, - - part - -where - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#42' - -​ and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') - -​ and l_quantity >= 6 and l_quantity <= 6 + 10 - -​ and p_size between 1 and 5 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - - or - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#55' - -​ and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') - -​ and l_quantity >= 20 and l_quantity <= 20 + 10 - -​ and p_size between 1 and 10 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - - or - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#24' - -​ and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') - -​ and l_quantity >= 23 and l_quantity <= 23 + 10 - -​ and p_size between 1 and 15 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - -LIMIT 1; -``` - -##### Q20 - -``` -select s_name,s_address - -from supplier,nation - -where - - s_suppkey in - - (select ps_suppkey - -​ from partsupp, - -​ ( - -​ select - -​ l_partkey agg_partkey, - -​ l_suppkey agg_suppkey, - -​ 0.5 * sum(l_quantity) AS agg_quantity - -​ from - -​ lineitem - -​ where - -​ l_shipdate >= date '1997-01-01' - -​ and l_shipdate < date '1997-01-01' + interval '1' year - -​ group by - -​ l_partkey, - -​ l_suppkey - -​ ) agg_lineitem - -​ where - -​ agg_partkey = ps_partkey - -​ and agg_suppkey = ps_suppkey - -​ and ps_partkey in - -​ ( - -​ select - -​ p_partkey - -​ from - -​ part - -​ where - -​ p_name like 'frosted%' - -​ ) - -​ and ps_availqty > agg_quantity - - ) - - and s_nationkey = n_nationkey - - and n_name = 'UNITED STATES' - -order by - - s_name - -LIMIT 1; -``` - -##### Q21 - -``` -select - - s_name, - - count(*) as numwait - -from - - supplier, - - lineitem l1, - - orders, - - nation - -where - - s_suppkey = l1.l_suppkey - - and o_orderkey = l1.l_orderkey - - and o_orderstatus = 'F' - - and l1.l_receiptdate > l1.l_commitdate - - and exists - - ( - -​ select - -​ * - -​ from - -​ lineitem l2 - -​ where - -​ l2.l_orderkey = l1.l_orderkey - -​ and l2.l_suppkey <> l1.l_suppkey - - ) - - and not exists - - ( - -​ select - -​ * - -​ from - -​ lineitem l3 - -​ where - -​ l3.l_orderkey = l1.l_orderkey - -​ and l3.l_suppkey <> l1.l_suppkey - -​ and l3.l_receiptdate > l3.l_commitdate - - ) - - and s_nationkey = n_nationkey - - and n_name = 'VIETNAM' - -group by - - s_name - -order by - - numwait desc, - - s_name - -LIMIT 100; -``` - -##### Q22 - -``` -select - - cntrycode, - - count(*) as numcust, - - sum(c_acctbal) as totacctbal - -from - -( - - select - -​ substring(c_phone from 1 for 2) as cntrycode, - -​ c_acctbal - - from - -​ customer - - where - -​ substring(c_phone from 1 for 2) in - -​ ('34', '18', '30', '24', '33', '22', '29') - -​ and c_acctbal > - -​ ( - -​ select - -​ avg(c_acctbal) - -​ from - -​ customer - -​ where - -​ c_acctbal > 0.00 - -​ and substring(c_phone from 1 for 2) in - -​ ('34', '18', '30', '24', '33', '22', '29') - -​ ) - -​ and not exists - -​ ( - -​ select - -​ * - -​ from - -​ orders - -​ where - -​ o_custkey = c_custkey - -​ ) - -) as custsale - -group by - - cntrycode - -order by - - cntrycode - -LIMIT 1; -``` diff --git a/product/zh/docs-mogdb/v2.0.0/poc/poc-jiangsumobile.assets/image-20210312105303222.png b/product/zh/docs-mogdb/v2.0.0/poc/poc-jiangsumobile.assets/image-20210312105303222.png deleted file mode 100644 index 616e33e610b0bca7f20fbef6bea75996c69b2d46..0000000000000000000000000000000000000000 Binary files a/product/zh/docs-mogdb/v2.0.0/poc/poc-jiangsumobile.assets/image-20210312105303222.png and /dev/null differ diff --git a/product/zh/docs-mogdb/v2.0.0/poc/poc-jiangsumobile.assets/image-20210312105352146.png b/product/zh/docs-mogdb/v2.0.0/poc/poc-jiangsumobile.assets/image-20210312105352146.png deleted file mode 100644 index 7d8d8d38fe5770b45b9a0b17ef3a9208d55d9133..0000000000000000000000000000000000000000 Binary files a/product/zh/docs-mogdb/v2.0.0/poc/poc-jiangsumobile.assets/image-20210312105352146.png and /dev/null differ diff --git a/product/zh/docs-mogdb/v2.0.0/poc/poc-jiangsumobile.md b/product/zh/docs-mogdb/v2.0.0/poc/poc-jiangsumobile.md deleted file mode 100644 index e8930d403a51548730c386926acd139bc98f44a6..0000000000000000000000000000000000000000 --- a/product/zh/docs-mogdb/v2.0.0/poc/poc-jiangsumobile.md +++ /dev/null @@ -1,1618 +0,0 @@ -# 某省移动MogDB 1.1.0版本测试报告 - -## POC前准备工作 - -### 操作系统版本及下载地址 - -| 介质名称 | 介质大小 | 最后更新时间 | -| ------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------- | -| [openEuler-20.03-LTS-aarch64-dvd.iso](https://repo.openeuler.org/openEuler-20.03-LTS/ISO/aarch64/openEuler-20.03-LTS-aarch64-dvd.iso) | 4.3 GiB | 2020-Mar-26 14:46 | - -#### 用户名和组 - -| 组名 | 组ID | 用途 | -| --------- | -------- | ------------- | -| root | 0 | administrator | -| bomc | 1302 | 网管 | -| osmgr | 1800 | OS管理 | -| xtjgmons | 5000 | 系统维护 | -| ==dbgrp== | ==5002== | ==MogDB== | - -| 用户名 | 用户ID | 所属用户组 | Home目录 | Shell | 用途 | -| -------- | -------- | ---------- | ------------- | --------- | ----------------- | -| root | 0 | root | /root | /bin/bash | administrator | -| toptea | 1302 | bomc | /toptea | /bin/bash | 网管 | -| osmgr | 1800 | osmgr | /home/osmgr | /bin/bash | OS管理 | -| dutyview | 5000 | xtjgmons | 5000 | 无 | 无 | -| dutywath | 5001 | xtjgmons | 5000 | 无 | 无 | -| ==omm== | ==5002== | ==dbgrp== | ====/home/omm | 无 | ==MogDB==系统用户 | - -### 本地盘划分 - -| lv卷名 | 文件系统 | 大小 | 属组 | 权限 | 系统格式 | 用途 | -| ------------------ | ---------- | ---- | ----- | ---- | -------- | -------------------------------------------------------- | -| vg_og/lv_ogdata | /ogdata | 2T | dbgrp | 755 | ext4 | datapath 存放数据文件 | -| vg_og/lv_ogxlog | /ogxlog | 500G | dbgrp | 755 | ext4 | 存放redo日志 | -| vg_og/lv_ogarchive | /ogarchive | 1T | dbgrp | 755 | ext4 | 存放归档日志 | -| rootvg | /mogdb | 200G | dbgrp | 755 | ext4 | 存放数据库二进制、日志、临时文件、socket文件、om维护命令 | -| vg_og/lv_ogbackup | /og_bak | 6T | dbgrp | 755 | ext4 | 存放数据备份 | - -## 服务器配置 - -| 机房位置 | 机架位置 | 设备数量 | 设备型号 | -| ------------ | --------- | -------- | ------------ | -| 浦口高新机房 | C11(2台) | 2 | 华为100 T130 | - -| 型号 | CPU | 内存 | 硬盘 | 数量 | -| ----------- | ------------------ | ---- | --------------------------------------------------------- | ---- | -| 华为100 T30 | 鲲鹏920 (48core)*2 | 384G | OS盘: 2块600G SAS RAID1
数据盘: 6块3.2T SSD RAID5 | 2台 | - -## IP地址 - -| 设备 | 主机名 | 主机型号 | 机柜 | 管理地址 | 业务地址 | -| ---- | -------- | ------------ | ---- | ------------- | ------------- | -| 华为 | npromgs3 | 华为100 T130 | C11 | 190.168.80.79 | 10.32.225.150 | -| 华为 | npromgs4 | 华为100 T130 | C11 | 190.168.80.80 | 10.32.225.151 | - -## 操作系统版本 - -``` -openEuler 20.3LTS -## -``` - -## 数据库信息 - -### 数据库版本 - -``` -gsql ((MogDB 1.1.0 build 5be05d82) compiled at 2021-01-06 17:23:14 commit 0 last mr ) -``` - -### 数据库主备信息 - -| 主库 | IP: 10.32.225.150 | 读写 | -| ---- | ----------------- | ---- | -| 备库 | IP: 10.32.225.151 | 只读 | - -## 测试结果所在目录 - -### IP: 10.32.225.150 - -| 测试项 | 目录 | -| -------------- | ---------------------------------- | -| 测试用例及日志 | /og_bak | -| TPCC测试及日志 | /root/benchmarksql-5.0/run/tpcclog | - -## 功能测试 - -### 兼容性 - -| 测试项 | 测试结果 | 说明 | -| --------------- | -------- | -------------------------------------------------------------------------------------------------------------- | -| 数据类型 | 通过 | 对于数值类型 字符类型 二进制类型 日期类型 布尔类型 时间间隔类型 数组类型 json类型等常用数据类型支持情况。 | -| 字符集 | 通过 | 支持utf-8(MySQL中应为utf8mb4),gbk等常见字符格式类型 | -| 基本SQL语法 | 通过 | 增删改查操作 | -| 复杂SQL | 通过 | 多种连接查询,包括交叉连接、自然连接、jion…using、jion..on、自连接、内连接、外连接 | -| 常用函数 | 通过 | union、union all、intersect等集合操作符 | -| 操作符 | 通过 | 逻辑操作符and or not | -| SQL语法及兼容性 | 通过 | commit/rollback/grant等DCL操作 | -| 其他高级SQL兼容 | 通过 | on duplicate key update、WITH RECURSIVE(start with … connect、with as、lock table、create table if not exists | -| 数据分区 | 通过 | 测试范围分区: 支持增加、拆分、合并、交换、删除分区 | -| 索引管理 | 通过 | 创建表并创建普通索引 | -| 约束 | 通过 | 创建表并创建约束 | -| 事务一致性 | 通过 | 原子性、一致性、隔离性、持久性特性 | -| mvcc | 通过 | 写之间不阻塞。SELECT是纯读操作,UPDATE和DELETE是读写操作。 | -| mot | 通过 | 内存表 | - -### 优化器 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ----------------------------- | -| 执行计划解析 | 通过 | 能够显式展现SQL语句的执行计划 | -| hint | 通过 | 能够支持加hint | -| 查询转换 | 通过 | 支持查询转换 | - -### 高级功能 - -| 测试项 | 测试结果 | 说明 | -| -------- | -------- | ---------------------------------------- | -| 存储过程 | 通过 | 测试存储过程的基本功能和过程中的控制语句 | -| 函数 | 通过 | 测试存储函数的创建和删除操作 | -| 视图 | 通过 | 支持视图建立、修改、删除 | -| 游标 | 通过 | 测试定义并使用引用游标 | -| 触发器 | 通过 | 测试insert/update/delete/instead of | -| 序列 | 通过 | 创建并使用序列、获取序列当前值和下一值 | - -## 安全性测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ------------------------------------------------------------ | -| 用户权限管理 | 通过 | 权限管理 | -| 角色权限管理 | 通过 | 角色管理 | -| 身份鉴别 | 通过 | 配置密码复杂度检查,密码的不可重用天数,帐户登录失败尝试次数 | -| 审计日志 | 通过 | 记录用户登录退出的审计日志 | - -## 高可用测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ---------------------------------------------------- | -| 读写分离 | 通过 | 主库建测试表,备库去读取内容 | -| 保护模式配置 | 通过 | 通过参数控制保护模式,同步模式(同步,异步,半同步) | - -## 备份恢复测试 - -| 测试项 | 测试结果 | 说明 | -| ---------------------- | -------- | -------------------------------------------------------------------------------- | -| 物理备份全量备份和恢复 | 通过 | 主库建测试表,备库去读取内容 | -| 逻辑备份和恢复 | 通过 | 是否支持在线逻辑备份,验证备份后数据恢复正确性和效率,在线备份期间对性能的影响。 | - -## 运维管理测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | --------------------------------------------------------------------------- | -| 报错信息 | 通过 | [errorcode](https://support.huaweicloud.com/errorcode-dws/dws_08_0001.html) | -| 性能视图 | 通过 | 和数据库相关的性能视图 | -| 性能分析报告 | 通过 | WDR类似Oracle AWR | -| 慢SQL视图 | 通过 | | -| 日志管理 | 通过 | 系统日志,操作日志,Trace日志,黑匣子日志,审计日志,WAL日志,性能日志。 | -| 监控运维 | 通过 | 常用的运维和定位问题手段 | - -## 性能测试 - -### TPCC - -#### 测试工具BenchmarkSQL v5.0及参数 - -| 序号 | 参数名称 | 值 | -| ---- | ---------- | -------------------------------------------- | -| 1 | db | postgres | -| 2 | driver | org.postgresql.Driver | -| 3 | conn | jdbc:postgresql://10.32.225.150:6432/tpcctst | -| 4 | user | tpccuser | -| 5 | warehouses | 10000 | - -> 说明:数据总容量大约100GB - -#### 测试用表的数据量 - -| 序号 | 表名 | 数据总数 | -| ---- | ---------------- | -------------------- | -| 1 | bmsql_config | 4 | -| 2 | bmsql_custome | 30014788 | -| 3 | bmsql_district | 10000 | -| 4 | bmsql_history | 29996623 | -| 5 | bmsql_item | 100000 | -| 6 | bmsql_new_order | 9000105 | -| 7 | bmsql_oorder | 29995891 | -| 8 | bmsql_order_line | 299981583(约1.9亿) | -| 9 | bmsql_stock | 100002396(约1亿) | -| 10 | bmsql_warehouse | 1000 | - -#### 测试结果 - -| 并发 | 时长(分钟) | tpmC (NewOrders) | -| ---- | ------------ | ------------------ | -| 400 | 1 | 383010.44 | -| 400 | 2 | 396593.65 | -| 400 | 5 | 366825.72 | -| 400 | 10 | 369191.96 | - -### TPCH - -#### 测试用表的数据量 - -##### 工具导入3GB数据 - -![image-20210312105303222](https://cdn-mogdb.enmotech.com/docs-media/111.png) - -##### 工具导入 TPC-H 30G 数据 - -![image-20210312105352146](https://cdn-mogdb.enmotech.com/docs-media/115.png) - -#### 测试结果 - -| 查询语句说明 | Query ID | 3GB数据 | 30GB数据 | -| ------------------------------------------------ | -------- | ------------ | ------------- | -| 价格统计报告查询 | Q1 | 86290.621 ms | 867229.922 ms | -| 最小代价供货商查询 | Q2 | 1588.686 ms | 29948.139 ms | -| 运送优先级查询 | Q3 | 9930.242 ms | 153179.243 ms | -| 订单优先级查询 | Q4 | 2413.140 ms | 29535.320 ms | -| 某地区供货商为公司带来的收入查询 | Q5 | 12687.063 ms | 146917.921 ms | -| 预测收入变化查询 | Q6 | 3381.666 ms | 77716.338 ms | -| 货运盈利情况查询 | Q7 | 6423.072 ms | 142928.852 ms | -| 国家市场份额查询 | Q8 | 7985.378 ms | 103726.748 ms | -| 产品类型利润估量查询 | Q9 | 28462.979 ms | 366562.292 ms | -| 货运存在问题的查询 | Q10 | 10098.798 ms | 149445.271 ms | -| 库存价值查询 | Q11 | 1915.023 ms | 23855.269 ms | -| 货运模式和订单优先级查询 | Q12 | 11048.061 ms | 119823.533 ms | -| 消费者订单数量查询 | Q13 | 9149.003 ms | 116618.514 ms | -| 促销效果查询 | Q14 | 1024.503 ms | 29369.667 ms | -| 查询获得某段时间内为总收入贡献最多的供货商的信息 | Q15 | 3011.973 ms | 101147.519 ms | -| 零件/供货商关系查询 | Q16 | 2253.134 ms | 28748.335 ms | -| 小订单收入查询 | Q17 | 35671.622 ms | 420488.742 ms | -| 大订单顾客查询 | Q18 | 30810.445 ms | 461710.335 ms | -| 折扣收入查询 | Q19 | 10483.329 ms | 107313.130 ms | -| 供货商竞争力查询 | Q20 | 7903.905 ms | 161276.226 ms | -| 不能按时交货供货商查询 | Q21 | 20424.039 ms | 264827.982 ms | -| 全球销售机会查询 | Q22 | 3458.196 ms | 50860.840 ms | - -#### TPCH测试SQL - -##### Q1 - -``` -select - - l_returnflag, - - l_linestatus, - - sum(l_quantity) as sum_qty, - - sum(l_extendedprice) as sum_base_price, - - sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, - - sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, - - avg(l_quantity) as avg_qty, - - avg(l_extendedprice) as avg_price, - - avg(l_discount) as avg_disc, - - count(*) as count_order - -from - - lineitem - -where - - l_shipdate <= date '1998-12-01' - interval '103' day - -group by - - l_returnflag, - - l_linestatus - -order by - - l_returnflag, - - l_linestatus - -LIMIT 1; -``` - -##### Q2 - -``` -select - - s_acctbal, - - s_name, - - n_name, - - p_partkey, - - p_mfgr, - - s_address, - - s_phone, - - s_comment - -from - - part, - - supplier, - - partsupp, - - nation, - - region, - - ( - -​ select - -​ ps_partkey, - -​ min(ps_supplycost) as min - -​ from - -​ partsupp, - -​ supplier, - -​ nation, - -​ region - -​ where - -​ s_suppkey = ps_suppkey - -​ and s_nationkey = n_nationkey - -​ and n_regionkey = r_regionkey - -​ and r_name = 'EUROPE' - -​ group by - -​ ps_partkey - - ) temp - -where - - p_partkey = partsupp.ps_partkey - - and s_suppkey = ps_suppkey - - and p_size = 47 - - and p_type like '%BRASS' - - and s_nationkey = n_nationkey - - and n_regionkey = r_regionkey - - and r_name = 'EUROPE' - - and ps_supplycost = temp.min - - and p_partkey = temp.ps_partkey - -order by - - s_acctbal desc, - - n_name, - - s_name, - - p_partkey - -LIMIT 100; -``` - -#### Q3 - -``` -select - - l_orderkey, - - sum(l_extendedprice * (1 - l_discount)) as revenue, - - o_orderdate, - - o_shippriority - -from - - customer, - - orders, - - lineitem - -where - - c_mktsegment = 'BUILDING' - - and c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and o_orderdate < date '1995-03-20' - - and l_shipdate > date '1995-03-20' - -group by - - l_orderkey, - - o_orderdate, - - o_shippriority - -order by - - revenue desc, - - o_orderdate - -LIMIT 10; -``` - -##### Q4 - -``` -select - - o_orderpriority, - - count(*) as order_count - -from - - orders - -where - - o_orderdate >= date '1995-12-01' - - and o_orderdate < date '1995-12-01' + interval '3' month - - and exists - - ( - -​ select - -​ * - -​ from - -​ lineitem - -​ where - -​ l_orderkey = o_orderkey - -​ and l_commitdate < l_receiptdate - -​ limit 1 - - ) - -group by - - o_orderpriority - -order by - - o_orderpriority - -LIMIT 1; -``` - -##### Q5 - -``` -select - - n_name, - - sum(l_extendedprice * (1 - l_discount)) as revenue - -from - - customer, - - orders, - - lineitem, - - supplier, - - nation, - - region - -where - - c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and l_suppkey = s_suppkey - - and c_nationkey = s_nationkey - - and s_nationkey = n_nationkey - - and n_regionkey = r_regionkey - - and r_name = 'AMERICA' - - and o_orderdate >= date '1997-01-01' - - and o_orderdate < date '1997-01-01' + interval '1' year - -group by - - n_name - -order by - - revenue desc - -LIMIT 1; -``` - -##### Q6 - -``` -select - - sum(l_extendedprice * l_discount) as revenue - -from - - lineitem - -where - - l_shipdate >= date '1997-01-01' - - and l_shipdate < date '1997-01-01' + interval '1' year - - and l_discount between 0.07 - 0.01 and 0.07 + 0.01 - - and l_quantity < 24 - -LIMIT 1; -``` - -##### Q7 - -``` -select - - supp_nation, - - cust_nation, - - l_year, - - sum(volume) as revenue - -from - -( - - select - -​ n1.n_name as supp_nation, - -​ n2.n_name as cust_nation, - -​ extract(year from l_shipdate) as l_year, - -​ l_extendedprice * (1 - l_discount) as volume - - from - -​ supplier, - -​ lineitem, - -​ orders, - -​ customer, - -​ nation n1, - -​ nation n2 - - where - -​ s_suppkey = l_suppkey - -​ and o_orderkey = l_orderkey - -​ and c_custkey = o_custkey - -​ and s_nationkey = n1.n_nationkey - -​ and c_nationkey = n2.n_nationkey - -​ and - -​ ( - -​ (n1.n_name = 'CHINA' and n2.n_name = 'INDONESIA') - -​ or (n1.n_name = 'INDONESIA' and n2.n_name = 'CHINA') - -​ ) - -​ and l_shipdate between date '1995-01-01' and date '1996-12-31' - -) as shipping - -group by - - supp_nation, - - cust_nation, - - l_year - -order by - - supp_nation, - - cust_nation, - - l_year - -LIMIT 1; -``` - -##### Q8 - -``` -select - - o_year, - - sum(case - - when nation = 'INDONESIA' then volume - - else 0 - - end) / sum(volume) as mkt_share - -from - -( - - select - -​ extract(year from o_orderdate) as o_year, - -​ l_extendedprice * (1 - l_discount) as volume, - -​ n2.n_name as nation - -​ from - -​ part, - -​ supplier, - -​ lineitem, - -​ orders, - -​ customer, - -​ nation n1, - -​ nation n2, - -​ region - - where - -​ p_partkey = l_partkey - -​ and s_suppkey = l_suppkey - -​ and l_orderkey = o_orderkey - -​ and o_custkey = c_custkey - -​ and c_nationkey = n1.n_nationkey - -​ and n1.n_regionkey = r_regionkey - -​ and r_name = 'ASIA' - -​ and s_nationkey = n2.n_nationkey - -​ and o_orderdate between date '1995-01-01' and date '1996-12-31' - -​ and p_type = 'PROMO POLISHED TIN' - -) as all_nations - -group by - - o_year - -order by - - o_year - -LIMIT 1; -``` - -##### Q9 - -``` -select - - nation, - - o_year, - - sum(amount) as sum_profit - -from - -( - - select - -​ n_name as nation, - -​ extract(year from o_orderdate) as o_year, - -​ l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount - - from - -​ part, - -​ supplier, - -​ lineitem, - -​ partsupp, - -​ orders, - -​ nation - - where - -​ s_suppkey = l_suppkey - -​ and ps_suppkey = l_suppkey - -​ and ps_partkey = l_partkey - -​ and p_partkey = l_partkey - -​ and o_orderkey = l_orderkey - -​ and s_nationkey = n_nationkey - -​ and p_name like '%thistle%' - -) as profit - -group by - - nation, - - o_year - -order by - - nation, - - o_year desc - -LIMIT 1; -``` - -##### Q10 - -``` -select - - c_custkey, - - c_name, - - sum(l_extendedprice * (1 - l_discount)) as revenue, - - c_acctbal, - - n_name, - - c_address, - - c_phone, - - c_comment - -from - - customer, - - orders, - - lineitem, - - nation - -where - - c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and o_orderdate >= date '1994-06-01' - - and o_orderdate < date '1994-06-01' + interval '3' month - - and l_returnflag = 'R' - - and c_nationkey = n_nationkey - -group by - - c_custkey, - - c_name, - - c_acctbal, - - c_phone, - - n_name, - - c_address, - - c_comment - -order by - - revenue desc - -LIMIT 20; -``` - -##### Q11 - -``` -select - - ps_partkey, - - sum(ps_supplycost * ps_availqty) as value - -from - - partsupp, - - supplier, - - nation - -where - - ps_suppkey = s_suppkey - - and s_nationkey = n_nationkey - - and n_name = 'ALGERIA' - -group by - - ps_partkey having - - sum(ps_supplycost * ps_availqty) > - - ( - -​ select - -​ sum(ps_supplycost * ps_availqty) * 0.0001000000 - -​ from - -​ partsupp, - -​ supplier, - -​ nation - -​ where - -​ ps_suppkey = s_suppkey - -​ and s_nationkey = n_nationkey - -​ and n_name = 'ALGERIA' - - ) - -order by - - value desc - -LIMIT 1; -``` - -##### Q12 - -``` -select - - l_shipmode, - - sum(case when o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' then 1 else 0 end) as high_line_count, - - sum(case when o_orderpriority <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end) as low_line_count - -from - - orders, - - lineitem - -where - - o_orderkey = l_orderkey - - and l_shipmode in ('RAIL', 'SHIP') - - and l_commitdate < l_receiptdate - - and l_shipdate < l_commitdate - - and l_receiptdate >= date '1994-01-01' - - and l_receiptdate < date '1994-01-01' + interval '1' year - -group by - - l_shipmode - -order by - - l_shipmode - -LIMIT 1; -``` - -##### Q13 - -``` -select - - c_count, - - count(*) as custdist - -from - -( - - select - -​ c_custkey, - -​ count(o_orderkey) - - from - -​ customer left outer join orders on - -​ c_custkey = o_custkey - -​ and o_comment not like '%express%packages%' - - group by - -​ c_custkey - -) as c_orders (c_custkey, c_count) - -group by - - c_count - -order by - - custdist desc, - - c_count desc - -LIMIT 1; -``` - -##### Q14 - -``` -select - - 100.00 * sum(case when p_type like 'PROMO%' then l_extendedprice * (1 - l_discount) else 0 end) /sum(l_extendedprice * (1 - l_discount)) as promo_revenue - -from - - lineitem, - - part - -where - - l_partkey = p_partkey - - and l_shipdate >= date '1994-02-01' - - and l_shipdate < date '1994-02-01' + interval '1' month - -LIMIT 1; -``` - -##### 用到的视图 - -``` -create or replace view revenue0 (supplier_no, total_revenue) as - -select - - l_suppkey, - - sum(l_extendedprice * (1 - l_discount)) - -from - - lineitem - -where - - l_shipdate >= date '1994-02-01' - - and l_shipdate < date '1994-02-01' + interval '3' month - -group by - - l_suppkey; -``` - -##### Q15 - -``` -select - - s_suppkey, - - s_name, - - s_address, - - s_phone, - - total_revenue - -from - - supplier, - - revenue0 - -where - - s_suppkey = supplier_no - - and total_revenue = - - ( - -​ select - -​ max(total_revenue) - -​ from - -​ revenue0 - - ) - -order by - - s_suppkey - -LIMIT 1; -``` - -##### Q16 - -``` -select - - p_brand, - - p_type, - - p_size, - - count(distinct ps_suppkey) as supplier_cnt - -from - - partsupp, - - part - -where - - p_partkey = ps_partkey - - and p_brand <> 'Brand#55' - - and p_type not like 'MEDIUM PLATED%' - - and p_size in (35, 17, 43, 49, 19, 41, 30, 47) - - and ps_suppkey not in - - ( - -​ select - -​ s_suppkey - -​ from - -​ supplier - -​ where - -​ s_comment like '%Customer%Complaints%' - - ) - -group by - - p_brand, - - p_type, - - p_size - -order by - - supplier_cnt desc, - - p_brand, - - p_type, - - p_size - -LIMIT 1; -``` - -##### Q17 - -``` -select - - sum(l_extendedprice) / 7.0 as avg_yearly - -from - - lineitem, - - part, - - (SELECT l_partkey AS agg_partkey, 0.2 * avg(l_quantity) AS avg_quantity FROM lineitem GROUP BY l_partkey) part_agg - -where - - p_partkey = l_partkey - - and agg_partkey = l_partkey - - and p_brand = 'Brand#53' - - and p_container = 'JUMBO JAR' - - and l_quantity < avg_quantity - -LIMIT 1; -``` - -#### Q18 - -``` -select - - c_name, - - c_custkey, - - o_orderkey, - - o_orderdate, - - o_totalprice, - - sum(l_quantity) - -from - - customer, - - orders, - - lineitem - -where - - o_orderkey in - - ( - -​ select - -​ l_orderkey - -​ from - -​ lineitem - -​ group by - -​ l_orderkey having - -​ sum(l_quantity) > 313 - - ) - - and c_custkey = o_custkey - - and o_orderkey = l_orderkey - -group by - - c_name, - - c_custkey, - - o_orderkey, - - o_orderdate, - - o_totalprice - -order by - - o_totalprice desc, - - o_orderdate - -LIMIT 100; -``` - -##### Q19 - -``` -select - - sum(l_extendedprice* (1 - l_discount)) as revenue - -from - - lineitem, - - part - -where - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#42' - -​ and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') - -​ and l_quantity >= 6 and l_quantity <= 6 + 10 - -​ and p_size between 1 and 5 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - - or - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#55' - -​ and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') - -​ and l_quantity >= 20 and l_quantity <= 20 + 10 - -​ and p_size between 1 and 10 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - - or - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#24' - -​ and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') - -​ and l_quantity >= 23 and l_quantity <= 23 + 10 - -​ and p_size between 1 and 15 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - -LIMIT 1; -``` - -##### Q20 - -``` -select s_name,s_address - -from supplier,nation - -where - - s_suppkey in - - (select ps_suppkey - -​ from partsupp, - -​ ( - -​ select - -​ l_partkey agg_partkey, - -​ l_suppkey agg_suppkey, - -​ 0.5 * sum(l_quantity) AS agg_quantity - -​ from - -​ lineitem - -​ where - -​ l_shipdate >= date '1997-01-01' - -​ and l_shipdate < date '1997-01-01' + interval '1' year - -​ group by - -​ l_partkey, - -​ l_suppkey - -​ ) agg_lineitem - -​ where - -​ agg_partkey = ps_partkey - -​ and agg_suppkey = ps_suppkey - -​ and ps_partkey in - -​ ( - -​ select - -​ p_partkey - -​ from - -​ part - -​ where - -​ p_name like 'frosted%' - -​ ) - -​ and ps_availqty > agg_quantity - - ) - - and s_nationkey = n_nationkey - - and n_name = 'UNITED STATES' - -order by - - s_name - -LIMIT 1; -``` - -##### Q21 - -``` -select - - s_name, - - count(*) as numwait - -from - - supplier, - - lineitem l1, - - orders, - - nation - -where - - s_suppkey = l1.l_suppkey - - and o_orderkey = l1.l_orderkey - - and o_orderstatus = 'F' - - and l1.l_receiptdate > l1.l_commitdate - - and exists - - ( - -​ select - -​ * - -​ from - -​ lineitem l2 - -​ where - -​ l2.l_orderkey = l1.l_orderkey - -​ and l2.l_suppkey <> l1.l_suppkey - - ) - - and not exists - - ( - -​ select - -​ * - -​ from - -​ lineitem l3 - -​ where - -​ l3.l_orderkey = l1.l_orderkey - -​ and l3.l_suppkey <> l1.l_suppkey - -​ and l3.l_receiptdate > l3.l_commitdate - - ) - - and s_nationkey = n_nationkey - - and n_name = 'VIETNAM' - -group by - - s_name - -order by - - numwait desc, - - s_name - -LIMIT 100; -``` - -##### Q22 - -``` -select - - cntrycode, - - count(*) as numcust, - - sum(c_acctbal) as totacctbal - -from - -( - - select - -​ substring(c_phone from 1 for 2) as cntrycode, - -​ c_acctbal - - from - -​ customer - - where - -​ substring(c_phone from 1 for 2) in - -​ ('34', '18', '30', '24', '33', '22', '29') - -​ and c_acctbal > - -​ ( - -​ select - -​ avg(c_acctbal) - -​ from - -​ customer - -​ where - -​ c_acctbal > 0.00 - -​ and substring(c_phone from 1 for 2) in - -​ ('34', '18', '30', '24', '33', '22', '29') - -​ ) - -​ and not exists - -​ ( - -​ select - -​ * - -​ from - -​ orders - -​ where - -​ o_custkey = c_custkey - -​ ) - -) as custsale - -group by - - cntrycode - -order by - - cntrycode - -LIMIT 1; -``` diff --git a/product/zh/docs-mogdb/v2.0.1/poc/poc-jiangsumobile.assets/image-20210312105303222.png b/product/zh/docs-mogdb/v2.0.1/poc/poc-jiangsumobile.assets/image-20210312105303222.png deleted file mode 100644 index 616e33e610b0bca7f20fbef6bea75996c69b2d46..0000000000000000000000000000000000000000 Binary files a/product/zh/docs-mogdb/v2.0.1/poc/poc-jiangsumobile.assets/image-20210312105303222.png and /dev/null differ diff --git a/product/zh/docs-mogdb/v2.0.1/poc/poc-jiangsumobile.assets/image-20210312105352146.png b/product/zh/docs-mogdb/v2.0.1/poc/poc-jiangsumobile.assets/image-20210312105352146.png deleted file mode 100644 index 7d8d8d38fe5770b45b9a0b17ef3a9208d55d9133..0000000000000000000000000000000000000000 Binary files a/product/zh/docs-mogdb/v2.0.1/poc/poc-jiangsumobile.assets/image-20210312105352146.png and /dev/null differ diff --git a/product/zh/docs-mogdb/v2.0.1/poc/poc-jiangsumobile.md b/product/zh/docs-mogdb/v2.0.1/poc/poc-jiangsumobile.md deleted file mode 100644 index e8930d403a51548730c386926acd139bc98f44a6..0000000000000000000000000000000000000000 --- a/product/zh/docs-mogdb/v2.0.1/poc/poc-jiangsumobile.md +++ /dev/null @@ -1,1618 +0,0 @@ -# 某省移动MogDB 1.1.0版本测试报告 - -## POC前准备工作 - -### 操作系统版本及下载地址 - -| 介质名称 | 介质大小 | 最后更新时间 | -| ------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------- | -| [openEuler-20.03-LTS-aarch64-dvd.iso](https://repo.openeuler.org/openEuler-20.03-LTS/ISO/aarch64/openEuler-20.03-LTS-aarch64-dvd.iso) | 4.3 GiB | 2020-Mar-26 14:46 | - -#### 用户名和组 - -| 组名 | 组ID | 用途 | -| --------- | -------- | ------------- | -| root | 0 | administrator | -| bomc | 1302 | 网管 | -| osmgr | 1800 | OS管理 | -| xtjgmons | 5000 | 系统维护 | -| ==dbgrp== | ==5002== | ==MogDB== | - -| 用户名 | 用户ID | 所属用户组 | Home目录 | Shell | 用途 | -| -------- | -------- | ---------- | ------------- | --------- | ----------------- | -| root | 0 | root | /root | /bin/bash | administrator | -| toptea | 1302 | bomc | /toptea | /bin/bash | 网管 | -| osmgr | 1800 | osmgr | /home/osmgr | /bin/bash | OS管理 | -| dutyview | 5000 | xtjgmons | 5000 | 无 | 无 | -| dutywath | 5001 | xtjgmons | 5000 | 无 | 无 | -| ==omm== | ==5002== | ==dbgrp== | ====/home/omm | 无 | ==MogDB==系统用户 | - -### 本地盘划分 - -| lv卷名 | 文件系统 | 大小 | 属组 | 权限 | 系统格式 | 用途 | -| ------------------ | ---------- | ---- | ----- | ---- | -------- | -------------------------------------------------------- | -| vg_og/lv_ogdata | /ogdata | 2T | dbgrp | 755 | ext4 | datapath 存放数据文件 | -| vg_og/lv_ogxlog | /ogxlog | 500G | dbgrp | 755 | ext4 | 存放redo日志 | -| vg_og/lv_ogarchive | /ogarchive | 1T | dbgrp | 755 | ext4 | 存放归档日志 | -| rootvg | /mogdb | 200G | dbgrp | 755 | ext4 | 存放数据库二进制、日志、临时文件、socket文件、om维护命令 | -| vg_og/lv_ogbackup | /og_bak | 6T | dbgrp | 755 | ext4 | 存放数据备份 | - -## 服务器配置 - -| 机房位置 | 机架位置 | 设备数量 | 设备型号 | -| ------------ | --------- | -------- | ------------ | -| 浦口高新机房 | C11(2台) | 2 | 华为100 T130 | - -| 型号 | CPU | 内存 | 硬盘 | 数量 | -| ----------- | ------------------ | ---- | --------------------------------------------------------- | ---- | -| 华为100 T30 | 鲲鹏920 (48core)*2 | 384G | OS盘: 2块600G SAS RAID1
数据盘: 6块3.2T SSD RAID5 | 2台 | - -## IP地址 - -| 设备 | 主机名 | 主机型号 | 机柜 | 管理地址 | 业务地址 | -| ---- | -------- | ------------ | ---- | ------------- | ------------- | -| 华为 | npromgs3 | 华为100 T130 | C11 | 190.168.80.79 | 10.32.225.150 | -| 华为 | npromgs4 | 华为100 T130 | C11 | 190.168.80.80 | 10.32.225.151 | - -## 操作系统版本 - -``` -openEuler 20.3LTS -## -``` - -## 数据库信息 - -### 数据库版本 - -``` -gsql ((MogDB 1.1.0 build 5be05d82) compiled at 2021-01-06 17:23:14 commit 0 last mr ) -``` - -### 数据库主备信息 - -| 主库 | IP: 10.32.225.150 | 读写 | -| ---- | ----------------- | ---- | -| 备库 | IP: 10.32.225.151 | 只读 | - -## 测试结果所在目录 - -### IP: 10.32.225.150 - -| 测试项 | 目录 | -| -------------- | ---------------------------------- | -| 测试用例及日志 | /og_bak | -| TPCC测试及日志 | /root/benchmarksql-5.0/run/tpcclog | - -## 功能测试 - -### 兼容性 - -| 测试项 | 测试结果 | 说明 | -| --------------- | -------- | -------------------------------------------------------------------------------------------------------------- | -| 数据类型 | 通过 | 对于数值类型 字符类型 二进制类型 日期类型 布尔类型 时间间隔类型 数组类型 json类型等常用数据类型支持情况。 | -| 字符集 | 通过 | 支持utf-8(MySQL中应为utf8mb4),gbk等常见字符格式类型 | -| 基本SQL语法 | 通过 | 增删改查操作 | -| 复杂SQL | 通过 | 多种连接查询,包括交叉连接、自然连接、jion…using、jion..on、自连接、内连接、外连接 | -| 常用函数 | 通过 | union、union all、intersect等集合操作符 | -| 操作符 | 通过 | 逻辑操作符and or not | -| SQL语法及兼容性 | 通过 | commit/rollback/grant等DCL操作 | -| 其他高级SQL兼容 | 通过 | on duplicate key update、WITH RECURSIVE(start with … connect、with as、lock table、create table if not exists | -| 数据分区 | 通过 | 测试范围分区: 支持增加、拆分、合并、交换、删除分区 | -| 索引管理 | 通过 | 创建表并创建普通索引 | -| 约束 | 通过 | 创建表并创建约束 | -| 事务一致性 | 通过 | 原子性、一致性、隔离性、持久性特性 | -| mvcc | 通过 | 写之间不阻塞。SELECT是纯读操作,UPDATE和DELETE是读写操作。 | -| mot | 通过 | 内存表 | - -### 优化器 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ----------------------------- | -| 执行计划解析 | 通过 | 能够显式展现SQL语句的执行计划 | -| hint | 通过 | 能够支持加hint | -| 查询转换 | 通过 | 支持查询转换 | - -### 高级功能 - -| 测试项 | 测试结果 | 说明 | -| -------- | -------- | ---------------------------------------- | -| 存储过程 | 通过 | 测试存储过程的基本功能和过程中的控制语句 | -| 函数 | 通过 | 测试存储函数的创建和删除操作 | -| 视图 | 通过 | 支持视图建立、修改、删除 | -| 游标 | 通过 | 测试定义并使用引用游标 | -| 触发器 | 通过 | 测试insert/update/delete/instead of | -| 序列 | 通过 | 创建并使用序列、获取序列当前值和下一值 | - -## 安全性测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ------------------------------------------------------------ | -| 用户权限管理 | 通过 | 权限管理 | -| 角色权限管理 | 通过 | 角色管理 | -| 身份鉴别 | 通过 | 配置密码复杂度检查,密码的不可重用天数,帐户登录失败尝试次数 | -| 审计日志 | 通过 | 记录用户登录退出的审计日志 | - -## 高可用测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ---------------------------------------------------- | -| 读写分离 | 通过 | 主库建测试表,备库去读取内容 | -| 保护模式配置 | 通过 | 通过参数控制保护模式,同步模式(同步,异步,半同步) | - -## 备份恢复测试 - -| 测试项 | 测试结果 | 说明 | -| ---------------------- | -------- | -------------------------------------------------------------------------------- | -| 物理备份全量备份和恢复 | 通过 | 主库建测试表,备库去读取内容 | -| 逻辑备份和恢复 | 通过 | 是否支持在线逻辑备份,验证备份后数据恢复正确性和效率,在线备份期间对性能的影响。 | - -## 运维管理测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | --------------------------------------------------------------------------- | -| 报错信息 | 通过 | [errorcode](https://support.huaweicloud.com/errorcode-dws/dws_08_0001.html) | -| 性能视图 | 通过 | 和数据库相关的性能视图 | -| 性能分析报告 | 通过 | WDR类似Oracle AWR | -| 慢SQL视图 | 通过 | | -| 日志管理 | 通过 | 系统日志,操作日志,Trace日志,黑匣子日志,审计日志,WAL日志,性能日志。 | -| 监控运维 | 通过 | 常用的运维和定位问题手段 | - -## 性能测试 - -### TPCC - -#### 测试工具BenchmarkSQL v5.0及参数 - -| 序号 | 参数名称 | 值 | -| ---- | ---------- | -------------------------------------------- | -| 1 | db | postgres | -| 2 | driver | org.postgresql.Driver | -| 3 | conn | jdbc:postgresql://10.32.225.150:6432/tpcctst | -| 4 | user | tpccuser | -| 5 | warehouses | 10000 | - -> 说明:数据总容量大约100GB - -#### 测试用表的数据量 - -| 序号 | 表名 | 数据总数 | -| ---- | ---------------- | -------------------- | -| 1 | bmsql_config | 4 | -| 2 | bmsql_custome | 30014788 | -| 3 | bmsql_district | 10000 | -| 4 | bmsql_history | 29996623 | -| 5 | bmsql_item | 100000 | -| 6 | bmsql_new_order | 9000105 | -| 7 | bmsql_oorder | 29995891 | -| 8 | bmsql_order_line | 299981583(约1.9亿) | -| 9 | bmsql_stock | 100002396(约1亿) | -| 10 | bmsql_warehouse | 1000 | - -#### 测试结果 - -| 并发 | 时长(分钟) | tpmC (NewOrders) | -| ---- | ------------ | ------------------ | -| 400 | 1 | 383010.44 | -| 400 | 2 | 396593.65 | -| 400 | 5 | 366825.72 | -| 400 | 10 | 369191.96 | - -### TPCH - -#### 测试用表的数据量 - -##### 工具导入3GB数据 - -![image-20210312105303222](https://cdn-mogdb.enmotech.com/docs-media/111.png) - -##### 工具导入 TPC-H 30G 数据 - -![image-20210312105352146](https://cdn-mogdb.enmotech.com/docs-media/115.png) - -#### 测试结果 - -| 查询语句说明 | Query ID | 3GB数据 | 30GB数据 | -| ------------------------------------------------ | -------- | ------------ | ------------- | -| 价格统计报告查询 | Q1 | 86290.621 ms | 867229.922 ms | -| 最小代价供货商查询 | Q2 | 1588.686 ms | 29948.139 ms | -| 运送优先级查询 | Q3 | 9930.242 ms | 153179.243 ms | -| 订单优先级查询 | Q4 | 2413.140 ms | 29535.320 ms | -| 某地区供货商为公司带来的收入查询 | Q5 | 12687.063 ms | 146917.921 ms | -| 预测收入变化查询 | Q6 | 3381.666 ms | 77716.338 ms | -| 货运盈利情况查询 | Q7 | 6423.072 ms | 142928.852 ms | -| 国家市场份额查询 | Q8 | 7985.378 ms | 103726.748 ms | -| 产品类型利润估量查询 | Q9 | 28462.979 ms | 366562.292 ms | -| 货运存在问题的查询 | Q10 | 10098.798 ms | 149445.271 ms | -| 库存价值查询 | Q11 | 1915.023 ms | 23855.269 ms | -| 货运模式和订单优先级查询 | Q12 | 11048.061 ms | 119823.533 ms | -| 消费者订单数量查询 | Q13 | 9149.003 ms | 116618.514 ms | -| 促销效果查询 | Q14 | 1024.503 ms | 29369.667 ms | -| 查询获得某段时间内为总收入贡献最多的供货商的信息 | Q15 | 3011.973 ms | 101147.519 ms | -| 零件/供货商关系查询 | Q16 | 2253.134 ms | 28748.335 ms | -| 小订单收入查询 | Q17 | 35671.622 ms | 420488.742 ms | -| 大订单顾客查询 | Q18 | 30810.445 ms | 461710.335 ms | -| 折扣收入查询 | Q19 | 10483.329 ms | 107313.130 ms | -| 供货商竞争力查询 | Q20 | 7903.905 ms | 161276.226 ms | -| 不能按时交货供货商查询 | Q21 | 20424.039 ms | 264827.982 ms | -| 全球销售机会查询 | Q22 | 3458.196 ms | 50860.840 ms | - -#### TPCH测试SQL - -##### Q1 - -``` -select - - l_returnflag, - - l_linestatus, - - sum(l_quantity) as sum_qty, - - sum(l_extendedprice) as sum_base_price, - - sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, - - sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, - - avg(l_quantity) as avg_qty, - - avg(l_extendedprice) as avg_price, - - avg(l_discount) as avg_disc, - - count(*) as count_order - -from - - lineitem - -where - - l_shipdate <= date '1998-12-01' - interval '103' day - -group by - - l_returnflag, - - l_linestatus - -order by - - l_returnflag, - - l_linestatus - -LIMIT 1; -``` - -##### Q2 - -``` -select - - s_acctbal, - - s_name, - - n_name, - - p_partkey, - - p_mfgr, - - s_address, - - s_phone, - - s_comment - -from - - part, - - supplier, - - partsupp, - - nation, - - region, - - ( - -​ select - -​ ps_partkey, - -​ min(ps_supplycost) as min - -​ from - -​ partsupp, - -​ supplier, - -​ nation, - -​ region - -​ where - -​ s_suppkey = ps_suppkey - -​ and s_nationkey = n_nationkey - -​ and n_regionkey = r_regionkey - -​ and r_name = 'EUROPE' - -​ group by - -​ ps_partkey - - ) temp - -where - - p_partkey = partsupp.ps_partkey - - and s_suppkey = ps_suppkey - - and p_size = 47 - - and p_type like '%BRASS' - - and s_nationkey = n_nationkey - - and n_regionkey = r_regionkey - - and r_name = 'EUROPE' - - and ps_supplycost = temp.min - - and p_partkey = temp.ps_partkey - -order by - - s_acctbal desc, - - n_name, - - s_name, - - p_partkey - -LIMIT 100; -``` - -#### Q3 - -``` -select - - l_orderkey, - - sum(l_extendedprice * (1 - l_discount)) as revenue, - - o_orderdate, - - o_shippriority - -from - - customer, - - orders, - - lineitem - -where - - c_mktsegment = 'BUILDING' - - and c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and o_orderdate < date '1995-03-20' - - and l_shipdate > date '1995-03-20' - -group by - - l_orderkey, - - o_orderdate, - - o_shippriority - -order by - - revenue desc, - - o_orderdate - -LIMIT 10; -``` - -##### Q4 - -``` -select - - o_orderpriority, - - count(*) as order_count - -from - - orders - -where - - o_orderdate >= date '1995-12-01' - - and o_orderdate < date '1995-12-01' + interval '3' month - - and exists - - ( - -​ select - -​ * - -​ from - -​ lineitem - -​ where - -​ l_orderkey = o_orderkey - -​ and l_commitdate < l_receiptdate - -​ limit 1 - - ) - -group by - - o_orderpriority - -order by - - o_orderpriority - -LIMIT 1; -``` - -##### Q5 - -``` -select - - n_name, - - sum(l_extendedprice * (1 - l_discount)) as revenue - -from - - customer, - - orders, - - lineitem, - - supplier, - - nation, - - region - -where - - c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and l_suppkey = s_suppkey - - and c_nationkey = s_nationkey - - and s_nationkey = n_nationkey - - and n_regionkey = r_regionkey - - and r_name = 'AMERICA' - - and o_orderdate >= date '1997-01-01' - - and o_orderdate < date '1997-01-01' + interval '1' year - -group by - - n_name - -order by - - revenue desc - -LIMIT 1; -``` - -##### Q6 - -``` -select - - sum(l_extendedprice * l_discount) as revenue - -from - - lineitem - -where - - l_shipdate >= date '1997-01-01' - - and l_shipdate < date '1997-01-01' + interval '1' year - - and l_discount between 0.07 - 0.01 and 0.07 + 0.01 - - and l_quantity < 24 - -LIMIT 1; -``` - -##### Q7 - -``` -select - - supp_nation, - - cust_nation, - - l_year, - - sum(volume) as revenue - -from - -( - - select - -​ n1.n_name as supp_nation, - -​ n2.n_name as cust_nation, - -​ extract(year from l_shipdate) as l_year, - -​ l_extendedprice * (1 - l_discount) as volume - - from - -​ supplier, - -​ lineitem, - -​ orders, - -​ customer, - -​ nation n1, - -​ nation n2 - - where - -​ s_suppkey = l_suppkey - -​ and o_orderkey = l_orderkey - -​ and c_custkey = o_custkey - -​ and s_nationkey = n1.n_nationkey - -​ and c_nationkey = n2.n_nationkey - -​ and - -​ ( - -​ (n1.n_name = 'CHINA' and n2.n_name = 'INDONESIA') - -​ or (n1.n_name = 'INDONESIA' and n2.n_name = 'CHINA') - -​ ) - -​ and l_shipdate between date '1995-01-01' and date '1996-12-31' - -) as shipping - -group by - - supp_nation, - - cust_nation, - - l_year - -order by - - supp_nation, - - cust_nation, - - l_year - -LIMIT 1; -``` - -##### Q8 - -``` -select - - o_year, - - sum(case - - when nation = 'INDONESIA' then volume - - else 0 - - end) / sum(volume) as mkt_share - -from - -( - - select - -​ extract(year from o_orderdate) as o_year, - -​ l_extendedprice * (1 - l_discount) as volume, - -​ n2.n_name as nation - -​ from - -​ part, - -​ supplier, - -​ lineitem, - -​ orders, - -​ customer, - -​ nation n1, - -​ nation n2, - -​ region - - where - -​ p_partkey = l_partkey - -​ and s_suppkey = l_suppkey - -​ and l_orderkey = o_orderkey - -​ and o_custkey = c_custkey - -​ and c_nationkey = n1.n_nationkey - -​ and n1.n_regionkey = r_regionkey - -​ and r_name = 'ASIA' - -​ and s_nationkey = n2.n_nationkey - -​ and o_orderdate between date '1995-01-01' and date '1996-12-31' - -​ and p_type = 'PROMO POLISHED TIN' - -) as all_nations - -group by - - o_year - -order by - - o_year - -LIMIT 1; -``` - -##### Q9 - -``` -select - - nation, - - o_year, - - sum(amount) as sum_profit - -from - -( - - select - -​ n_name as nation, - -​ extract(year from o_orderdate) as o_year, - -​ l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount - - from - -​ part, - -​ supplier, - -​ lineitem, - -​ partsupp, - -​ orders, - -​ nation - - where - -​ s_suppkey = l_suppkey - -​ and ps_suppkey = l_suppkey - -​ and ps_partkey = l_partkey - -​ and p_partkey = l_partkey - -​ and o_orderkey = l_orderkey - -​ and s_nationkey = n_nationkey - -​ and p_name like '%thistle%' - -) as profit - -group by - - nation, - - o_year - -order by - - nation, - - o_year desc - -LIMIT 1; -``` - -##### Q10 - -``` -select - - c_custkey, - - c_name, - - sum(l_extendedprice * (1 - l_discount)) as revenue, - - c_acctbal, - - n_name, - - c_address, - - c_phone, - - c_comment - -from - - customer, - - orders, - - lineitem, - - nation - -where - - c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and o_orderdate >= date '1994-06-01' - - and o_orderdate < date '1994-06-01' + interval '3' month - - and l_returnflag = 'R' - - and c_nationkey = n_nationkey - -group by - - c_custkey, - - c_name, - - c_acctbal, - - c_phone, - - n_name, - - c_address, - - c_comment - -order by - - revenue desc - -LIMIT 20; -``` - -##### Q11 - -``` -select - - ps_partkey, - - sum(ps_supplycost * ps_availqty) as value - -from - - partsupp, - - supplier, - - nation - -where - - ps_suppkey = s_suppkey - - and s_nationkey = n_nationkey - - and n_name = 'ALGERIA' - -group by - - ps_partkey having - - sum(ps_supplycost * ps_availqty) > - - ( - -​ select - -​ sum(ps_supplycost * ps_availqty) * 0.0001000000 - -​ from - -​ partsupp, - -​ supplier, - -​ nation - -​ where - -​ ps_suppkey = s_suppkey - -​ and s_nationkey = n_nationkey - -​ and n_name = 'ALGERIA' - - ) - -order by - - value desc - -LIMIT 1; -``` - -##### Q12 - -``` -select - - l_shipmode, - - sum(case when o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' then 1 else 0 end) as high_line_count, - - sum(case when o_orderpriority <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end) as low_line_count - -from - - orders, - - lineitem - -where - - o_orderkey = l_orderkey - - and l_shipmode in ('RAIL', 'SHIP') - - and l_commitdate < l_receiptdate - - and l_shipdate < l_commitdate - - and l_receiptdate >= date '1994-01-01' - - and l_receiptdate < date '1994-01-01' + interval '1' year - -group by - - l_shipmode - -order by - - l_shipmode - -LIMIT 1; -``` - -##### Q13 - -``` -select - - c_count, - - count(*) as custdist - -from - -( - - select - -​ c_custkey, - -​ count(o_orderkey) - - from - -​ customer left outer join orders on - -​ c_custkey = o_custkey - -​ and o_comment not like '%express%packages%' - - group by - -​ c_custkey - -) as c_orders (c_custkey, c_count) - -group by - - c_count - -order by - - custdist desc, - - c_count desc - -LIMIT 1; -``` - -##### Q14 - -``` -select - - 100.00 * sum(case when p_type like 'PROMO%' then l_extendedprice * (1 - l_discount) else 0 end) /sum(l_extendedprice * (1 - l_discount)) as promo_revenue - -from - - lineitem, - - part - -where - - l_partkey = p_partkey - - and l_shipdate >= date '1994-02-01' - - and l_shipdate < date '1994-02-01' + interval '1' month - -LIMIT 1; -``` - -##### 用到的视图 - -``` -create or replace view revenue0 (supplier_no, total_revenue) as - -select - - l_suppkey, - - sum(l_extendedprice * (1 - l_discount)) - -from - - lineitem - -where - - l_shipdate >= date '1994-02-01' - - and l_shipdate < date '1994-02-01' + interval '3' month - -group by - - l_suppkey; -``` - -##### Q15 - -``` -select - - s_suppkey, - - s_name, - - s_address, - - s_phone, - - total_revenue - -from - - supplier, - - revenue0 - -where - - s_suppkey = supplier_no - - and total_revenue = - - ( - -​ select - -​ max(total_revenue) - -​ from - -​ revenue0 - - ) - -order by - - s_suppkey - -LIMIT 1; -``` - -##### Q16 - -``` -select - - p_brand, - - p_type, - - p_size, - - count(distinct ps_suppkey) as supplier_cnt - -from - - partsupp, - - part - -where - - p_partkey = ps_partkey - - and p_brand <> 'Brand#55' - - and p_type not like 'MEDIUM PLATED%' - - and p_size in (35, 17, 43, 49, 19, 41, 30, 47) - - and ps_suppkey not in - - ( - -​ select - -​ s_suppkey - -​ from - -​ supplier - -​ where - -​ s_comment like '%Customer%Complaints%' - - ) - -group by - - p_brand, - - p_type, - - p_size - -order by - - supplier_cnt desc, - - p_brand, - - p_type, - - p_size - -LIMIT 1; -``` - -##### Q17 - -``` -select - - sum(l_extendedprice) / 7.0 as avg_yearly - -from - - lineitem, - - part, - - (SELECT l_partkey AS agg_partkey, 0.2 * avg(l_quantity) AS avg_quantity FROM lineitem GROUP BY l_partkey) part_agg - -where - - p_partkey = l_partkey - - and agg_partkey = l_partkey - - and p_brand = 'Brand#53' - - and p_container = 'JUMBO JAR' - - and l_quantity < avg_quantity - -LIMIT 1; -``` - -#### Q18 - -``` -select - - c_name, - - c_custkey, - - o_orderkey, - - o_orderdate, - - o_totalprice, - - sum(l_quantity) - -from - - customer, - - orders, - - lineitem - -where - - o_orderkey in - - ( - -​ select - -​ l_orderkey - -​ from - -​ lineitem - -​ group by - -​ l_orderkey having - -​ sum(l_quantity) > 313 - - ) - - and c_custkey = o_custkey - - and o_orderkey = l_orderkey - -group by - - c_name, - - c_custkey, - - o_orderkey, - - o_orderdate, - - o_totalprice - -order by - - o_totalprice desc, - - o_orderdate - -LIMIT 100; -``` - -##### Q19 - -``` -select - - sum(l_extendedprice* (1 - l_discount)) as revenue - -from - - lineitem, - - part - -where - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#42' - -​ and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') - -​ and l_quantity >= 6 and l_quantity <= 6 + 10 - -​ and p_size between 1 and 5 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - - or - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#55' - -​ and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') - -​ and l_quantity >= 20 and l_quantity <= 20 + 10 - -​ and p_size between 1 and 10 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - - or - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#24' - -​ and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') - -​ and l_quantity >= 23 and l_quantity <= 23 + 10 - -​ and p_size between 1 and 15 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - -LIMIT 1; -``` - -##### Q20 - -``` -select s_name,s_address - -from supplier,nation - -where - - s_suppkey in - - (select ps_suppkey - -​ from partsupp, - -​ ( - -​ select - -​ l_partkey agg_partkey, - -​ l_suppkey agg_suppkey, - -​ 0.5 * sum(l_quantity) AS agg_quantity - -​ from - -​ lineitem - -​ where - -​ l_shipdate >= date '1997-01-01' - -​ and l_shipdate < date '1997-01-01' + interval '1' year - -​ group by - -​ l_partkey, - -​ l_suppkey - -​ ) agg_lineitem - -​ where - -​ agg_partkey = ps_partkey - -​ and agg_suppkey = ps_suppkey - -​ and ps_partkey in - -​ ( - -​ select - -​ p_partkey - -​ from - -​ part - -​ where - -​ p_name like 'frosted%' - -​ ) - -​ and ps_availqty > agg_quantity - - ) - - and s_nationkey = n_nationkey - - and n_name = 'UNITED STATES' - -order by - - s_name - -LIMIT 1; -``` - -##### Q21 - -``` -select - - s_name, - - count(*) as numwait - -from - - supplier, - - lineitem l1, - - orders, - - nation - -where - - s_suppkey = l1.l_suppkey - - and o_orderkey = l1.l_orderkey - - and o_orderstatus = 'F' - - and l1.l_receiptdate > l1.l_commitdate - - and exists - - ( - -​ select - -​ * - -​ from - -​ lineitem l2 - -​ where - -​ l2.l_orderkey = l1.l_orderkey - -​ and l2.l_suppkey <> l1.l_suppkey - - ) - - and not exists - - ( - -​ select - -​ * - -​ from - -​ lineitem l3 - -​ where - -​ l3.l_orderkey = l1.l_orderkey - -​ and l3.l_suppkey <> l1.l_suppkey - -​ and l3.l_receiptdate > l3.l_commitdate - - ) - - and s_nationkey = n_nationkey - - and n_name = 'VIETNAM' - -group by - - s_name - -order by - - numwait desc, - - s_name - -LIMIT 100; -``` - -##### Q22 - -``` -select - - cntrycode, - - count(*) as numcust, - - sum(c_acctbal) as totacctbal - -from - -( - - select - -​ substring(c_phone from 1 for 2) as cntrycode, - -​ c_acctbal - - from - -​ customer - - where - -​ substring(c_phone from 1 for 2) in - -​ ('34', '18', '30', '24', '33', '22', '29') - -​ and c_acctbal > - -​ ( - -​ select - -​ avg(c_acctbal) - -​ from - -​ customer - -​ where - -​ c_acctbal > 0.00 - -​ and substring(c_phone from 1 for 2) in - -​ ('34', '18', '30', '24', '33', '22', '29') - -​ ) - -​ and not exists - -​ ( - -​ select - -​ * - -​ from - -​ orders - -​ where - -​ o_custkey = c_custkey - -​ ) - -) as custsale - -group by - - cntrycode - -order by - - cntrycode - -LIMIT 1; -``` diff --git a/product/zh/docs-mogdb/v2.1/poc/poc-jiangsumobile.assets/image-20210312105303222.png b/product/zh/docs-mogdb/v2.1/poc/poc-jiangsumobile.assets/image-20210312105303222.png deleted file mode 100644 index 616e33e610b0bca7f20fbef6bea75996c69b2d46..0000000000000000000000000000000000000000 Binary files a/product/zh/docs-mogdb/v2.1/poc/poc-jiangsumobile.assets/image-20210312105303222.png and /dev/null differ diff --git a/product/zh/docs-mogdb/v2.1/poc/poc-jiangsumobile.assets/image-20210312105352146.png b/product/zh/docs-mogdb/v2.1/poc/poc-jiangsumobile.assets/image-20210312105352146.png deleted file mode 100644 index 7d8d8d38fe5770b45b9a0b17ef3a9208d55d9133..0000000000000000000000000000000000000000 Binary files a/product/zh/docs-mogdb/v2.1/poc/poc-jiangsumobile.assets/image-20210312105352146.png and /dev/null differ diff --git a/product/zh/docs-mogdb/v2.1/poc/poc-jiangsumobile.md b/product/zh/docs-mogdb/v2.1/poc/poc-jiangsumobile.md deleted file mode 100644 index e8930d403a51548730c386926acd139bc98f44a6..0000000000000000000000000000000000000000 --- a/product/zh/docs-mogdb/v2.1/poc/poc-jiangsumobile.md +++ /dev/null @@ -1,1618 +0,0 @@ -# 某省移动MogDB 1.1.0版本测试报告 - -## POC前准备工作 - -### 操作系统版本及下载地址 - -| 介质名称 | 介质大小 | 最后更新时间 | -| ------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------- | -| [openEuler-20.03-LTS-aarch64-dvd.iso](https://repo.openeuler.org/openEuler-20.03-LTS/ISO/aarch64/openEuler-20.03-LTS-aarch64-dvd.iso) | 4.3 GiB | 2020-Mar-26 14:46 | - -#### 用户名和组 - -| 组名 | 组ID | 用途 | -| --------- | -------- | ------------- | -| root | 0 | administrator | -| bomc | 1302 | 网管 | -| osmgr | 1800 | OS管理 | -| xtjgmons | 5000 | 系统维护 | -| ==dbgrp== | ==5002== | ==MogDB== | - -| 用户名 | 用户ID | 所属用户组 | Home目录 | Shell | 用途 | -| -------- | -------- | ---------- | ------------- | --------- | ----------------- | -| root | 0 | root | /root | /bin/bash | administrator | -| toptea | 1302 | bomc | /toptea | /bin/bash | 网管 | -| osmgr | 1800 | osmgr | /home/osmgr | /bin/bash | OS管理 | -| dutyview | 5000 | xtjgmons | 5000 | 无 | 无 | -| dutywath | 5001 | xtjgmons | 5000 | 无 | 无 | -| ==omm== | ==5002== | ==dbgrp== | ====/home/omm | 无 | ==MogDB==系统用户 | - -### 本地盘划分 - -| lv卷名 | 文件系统 | 大小 | 属组 | 权限 | 系统格式 | 用途 | -| ------------------ | ---------- | ---- | ----- | ---- | -------- | -------------------------------------------------------- | -| vg_og/lv_ogdata | /ogdata | 2T | dbgrp | 755 | ext4 | datapath 存放数据文件 | -| vg_og/lv_ogxlog | /ogxlog | 500G | dbgrp | 755 | ext4 | 存放redo日志 | -| vg_og/lv_ogarchive | /ogarchive | 1T | dbgrp | 755 | ext4 | 存放归档日志 | -| rootvg | /mogdb | 200G | dbgrp | 755 | ext4 | 存放数据库二进制、日志、临时文件、socket文件、om维护命令 | -| vg_og/lv_ogbackup | /og_bak | 6T | dbgrp | 755 | ext4 | 存放数据备份 | - -## 服务器配置 - -| 机房位置 | 机架位置 | 设备数量 | 设备型号 | -| ------------ | --------- | -------- | ------------ | -| 浦口高新机房 | C11(2台) | 2 | 华为100 T130 | - -| 型号 | CPU | 内存 | 硬盘 | 数量 | -| ----------- | ------------------ | ---- | --------------------------------------------------------- | ---- | -| 华为100 T30 | 鲲鹏920 (48core)*2 | 384G | OS盘: 2块600G SAS RAID1
数据盘: 6块3.2T SSD RAID5 | 2台 | - -## IP地址 - -| 设备 | 主机名 | 主机型号 | 机柜 | 管理地址 | 业务地址 | -| ---- | -------- | ------------ | ---- | ------------- | ------------- | -| 华为 | npromgs3 | 华为100 T130 | C11 | 190.168.80.79 | 10.32.225.150 | -| 华为 | npromgs4 | 华为100 T130 | C11 | 190.168.80.80 | 10.32.225.151 | - -## 操作系统版本 - -``` -openEuler 20.3LTS -## -``` - -## 数据库信息 - -### 数据库版本 - -``` -gsql ((MogDB 1.1.0 build 5be05d82) compiled at 2021-01-06 17:23:14 commit 0 last mr ) -``` - -### 数据库主备信息 - -| 主库 | IP: 10.32.225.150 | 读写 | -| ---- | ----------------- | ---- | -| 备库 | IP: 10.32.225.151 | 只读 | - -## 测试结果所在目录 - -### IP: 10.32.225.150 - -| 测试项 | 目录 | -| -------------- | ---------------------------------- | -| 测试用例及日志 | /og_bak | -| TPCC测试及日志 | /root/benchmarksql-5.0/run/tpcclog | - -## 功能测试 - -### 兼容性 - -| 测试项 | 测试结果 | 说明 | -| --------------- | -------- | -------------------------------------------------------------------------------------------------------------- | -| 数据类型 | 通过 | 对于数值类型 字符类型 二进制类型 日期类型 布尔类型 时间间隔类型 数组类型 json类型等常用数据类型支持情况。 | -| 字符集 | 通过 | 支持utf-8(MySQL中应为utf8mb4),gbk等常见字符格式类型 | -| 基本SQL语法 | 通过 | 增删改查操作 | -| 复杂SQL | 通过 | 多种连接查询,包括交叉连接、自然连接、jion…using、jion..on、自连接、内连接、外连接 | -| 常用函数 | 通过 | union、union all、intersect等集合操作符 | -| 操作符 | 通过 | 逻辑操作符and or not | -| SQL语法及兼容性 | 通过 | commit/rollback/grant等DCL操作 | -| 其他高级SQL兼容 | 通过 | on duplicate key update、WITH RECURSIVE(start with … connect、with as、lock table、create table if not exists | -| 数据分区 | 通过 | 测试范围分区: 支持增加、拆分、合并、交换、删除分区 | -| 索引管理 | 通过 | 创建表并创建普通索引 | -| 约束 | 通过 | 创建表并创建约束 | -| 事务一致性 | 通过 | 原子性、一致性、隔离性、持久性特性 | -| mvcc | 通过 | 写之间不阻塞。SELECT是纯读操作,UPDATE和DELETE是读写操作。 | -| mot | 通过 | 内存表 | - -### 优化器 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ----------------------------- | -| 执行计划解析 | 通过 | 能够显式展现SQL语句的执行计划 | -| hint | 通过 | 能够支持加hint | -| 查询转换 | 通过 | 支持查询转换 | - -### 高级功能 - -| 测试项 | 测试结果 | 说明 | -| -------- | -------- | ---------------------------------------- | -| 存储过程 | 通过 | 测试存储过程的基本功能和过程中的控制语句 | -| 函数 | 通过 | 测试存储函数的创建和删除操作 | -| 视图 | 通过 | 支持视图建立、修改、删除 | -| 游标 | 通过 | 测试定义并使用引用游标 | -| 触发器 | 通过 | 测试insert/update/delete/instead of | -| 序列 | 通过 | 创建并使用序列、获取序列当前值和下一值 | - -## 安全性测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ------------------------------------------------------------ | -| 用户权限管理 | 通过 | 权限管理 | -| 角色权限管理 | 通过 | 角色管理 | -| 身份鉴别 | 通过 | 配置密码复杂度检查,密码的不可重用天数,帐户登录失败尝试次数 | -| 审计日志 | 通过 | 记录用户登录退出的审计日志 | - -## 高可用测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ---------------------------------------------------- | -| 读写分离 | 通过 | 主库建测试表,备库去读取内容 | -| 保护模式配置 | 通过 | 通过参数控制保护模式,同步模式(同步,异步,半同步) | - -## 备份恢复测试 - -| 测试项 | 测试结果 | 说明 | -| ---------------------- | -------- | -------------------------------------------------------------------------------- | -| 物理备份全量备份和恢复 | 通过 | 主库建测试表,备库去读取内容 | -| 逻辑备份和恢复 | 通过 | 是否支持在线逻辑备份,验证备份后数据恢复正确性和效率,在线备份期间对性能的影响。 | - -## 运维管理测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | --------------------------------------------------------------------------- | -| 报错信息 | 通过 | [errorcode](https://support.huaweicloud.com/errorcode-dws/dws_08_0001.html) | -| 性能视图 | 通过 | 和数据库相关的性能视图 | -| 性能分析报告 | 通过 | WDR类似Oracle AWR | -| 慢SQL视图 | 通过 | | -| 日志管理 | 通过 | 系统日志,操作日志,Trace日志,黑匣子日志,审计日志,WAL日志,性能日志。 | -| 监控运维 | 通过 | 常用的运维和定位问题手段 | - -## 性能测试 - -### TPCC - -#### 测试工具BenchmarkSQL v5.0及参数 - -| 序号 | 参数名称 | 值 | -| ---- | ---------- | -------------------------------------------- | -| 1 | db | postgres | -| 2 | driver | org.postgresql.Driver | -| 3 | conn | jdbc:postgresql://10.32.225.150:6432/tpcctst | -| 4 | user | tpccuser | -| 5 | warehouses | 10000 | - -> 说明:数据总容量大约100GB - -#### 测试用表的数据量 - -| 序号 | 表名 | 数据总数 | -| ---- | ---------------- | -------------------- | -| 1 | bmsql_config | 4 | -| 2 | bmsql_custome | 30014788 | -| 3 | bmsql_district | 10000 | -| 4 | bmsql_history | 29996623 | -| 5 | bmsql_item | 100000 | -| 6 | bmsql_new_order | 9000105 | -| 7 | bmsql_oorder | 29995891 | -| 8 | bmsql_order_line | 299981583(约1.9亿) | -| 9 | bmsql_stock | 100002396(约1亿) | -| 10 | bmsql_warehouse | 1000 | - -#### 测试结果 - -| 并发 | 时长(分钟) | tpmC (NewOrders) | -| ---- | ------------ | ------------------ | -| 400 | 1 | 383010.44 | -| 400 | 2 | 396593.65 | -| 400 | 5 | 366825.72 | -| 400 | 10 | 369191.96 | - -### TPCH - -#### 测试用表的数据量 - -##### 工具导入3GB数据 - -![image-20210312105303222](https://cdn-mogdb.enmotech.com/docs-media/111.png) - -##### 工具导入 TPC-H 30G 数据 - -![image-20210312105352146](https://cdn-mogdb.enmotech.com/docs-media/115.png) - -#### 测试结果 - -| 查询语句说明 | Query ID | 3GB数据 | 30GB数据 | -| ------------------------------------------------ | -------- | ------------ | ------------- | -| 价格统计报告查询 | Q1 | 86290.621 ms | 867229.922 ms | -| 最小代价供货商查询 | Q2 | 1588.686 ms | 29948.139 ms | -| 运送优先级查询 | Q3 | 9930.242 ms | 153179.243 ms | -| 订单优先级查询 | Q4 | 2413.140 ms | 29535.320 ms | -| 某地区供货商为公司带来的收入查询 | Q5 | 12687.063 ms | 146917.921 ms | -| 预测收入变化查询 | Q6 | 3381.666 ms | 77716.338 ms | -| 货运盈利情况查询 | Q7 | 6423.072 ms | 142928.852 ms | -| 国家市场份额查询 | Q8 | 7985.378 ms | 103726.748 ms | -| 产品类型利润估量查询 | Q9 | 28462.979 ms | 366562.292 ms | -| 货运存在问题的查询 | Q10 | 10098.798 ms | 149445.271 ms | -| 库存价值查询 | Q11 | 1915.023 ms | 23855.269 ms | -| 货运模式和订单优先级查询 | Q12 | 11048.061 ms | 119823.533 ms | -| 消费者订单数量查询 | Q13 | 9149.003 ms | 116618.514 ms | -| 促销效果查询 | Q14 | 1024.503 ms | 29369.667 ms | -| 查询获得某段时间内为总收入贡献最多的供货商的信息 | Q15 | 3011.973 ms | 101147.519 ms | -| 零件/供货商关系查询 | Q16 | 2253.134 ms | 28748.335 ms | -| 小订单收入查询 | Q17 | 35671.622 ms | 420488.742 ms | -| 大订单顾客查询 | Q18 | 30810.445 ms | 461710.335 ms | -| 折扣收入查询 | Q19 | 10483.329 ms | 107313.130 ms | -| 供货商竞争力查询 | Q20 | 7903.905 ms | 161276.226 ms | -| 不能按时交货供货商查询 | Q21 | 20424.039 ms | 264827.982 ms | -| 全球销售机会查询 | Q22 | 3458.196 ms | 50860.840 ms | - -#### TPCH测试SQL - -##### Q1 - -``` -select - - l_returnflag, - - l_linestatus, - - sum(l_quantity) as sum_qty, - - sum(l_extendedprice) as sum_base_price, - - sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, - - sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, - - avg(l_quantity) as avg_qty, - - avg(l_extendedprice) as avg_price, - - avg(l_discount) as avg_disc, - - count(*) as count_order - -from - - lineitem - -where - - l_shipdate <= date '1998-12-01' - interval '103' day - -group by - - l_returnflag, - - l_linestatus - -order by - - l_returnflag, - - l_linestatus - -LIMIT 1; -``` - -##### Q2 - -``` -select - - s_acctbal, - - s_name, - - n_name, - - p_partkey, - - p_mfgr, - - s_address, - - s_phone, - - s_comment - -from - - part, - - supplier, - - partsupp, - - nation, - - region, - - ( - -​ select - -​ ps_partkey, - -​ min(ps_supplycost) as min - -​ from - -​ partsupp, - -​ supplier, - -​ nation, - -​ region - -​ where - -​ s_suppkey = ps_suppkey - -​ and s_nationkey = n_nationkey - -​ and n_regionkey = r_regionkey - -​ and r_name = 'EUROPE' - -​ group by - -​ ps_partkey - - ) temp - -where - - p_partkey = partsupp.ps_partkey - - and s_suppkey = ps_suppkey - - and p_size = 47 - - and p_type like '%BRASS' - - and s_nationkey = n_nationkey - - and n_regionkey = r_regionkey - - and r_name = 'EUROPE' - - and ps_supplycost = temp.min - - and p_partkey = temp.ps_partkey - -order by - - s_acctbal desc, - - n_name, - - s_name, - - p_partkey - -LIMIT 100; -``` - -#### Q3 - -``` -select - - l_orderkey, - - sum(l_extendedprice * (1 - l_discount)) as revenue, - - o_orderdate, - - o_shippriority - -from - - customer, - - orders, - - lineitem - -where - - c_mktsegment = 'BUILDING' - - and c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and o_orderdate < date '1995-03-20' - - and l_shipdate > date '1995-03-20' - -group by - - l_orderkey, - - o_orderdate, - - o_shippriority - -order by - - revenue desc, - - o_orderdate - -LIMIT 10; -``` - -##### Q4 - -``` -select - - o_orderpriority, - - count(*) as order_count - -from - - orders - -where - - o_orderdate >= date '1995-12-01' - - and o_orderdate < date '1995-12-01' + interval '3' month - - and exists - - ( - -​ select - -​ * - -​ from - -​ lineitem - -​ where - -​ l_orderkey = o_orderkey - -​ and l_commitdate < l_receiptdate - -​ limit 1 - - ) - -group by - - o_orderpriority - -order by - - o_orderpriority - -LIMIT 1; -``` - -##### Q5 - -``` -select - - n_name, - - sum(l_extendedprice * (1 - l_discount)) as revenue - -from - - customer, - - orders, - - lineitem, - - supplier, - - nation, - - region - -where - - c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and l_suppkey = s_suppkey - - and c_nationkey = s_nationkey - - and s_nationkey = n_nationkey - - and n_regionkey = r_regionkey - - and r_name = 'AMERICA' - - and o_orderdate >= date '1997-01-01' - - and o_orderdate < date '1997-01-01' + interval '1' year - -group by - - n_name - -order by - - revenue desc - -LIMIT 1; -``` - -##### Q6 - -``` -select - - sum(l_extendedprice * l_discount) as revenue - -from - - lineitem - -where - - l_shipdate >= date '1997-01-01' - - and l_shipdate < date '1997-01-01' + interval '1' year - - and l_discount between 0.07 - 0.01 and 0.07 + 0.01 - - and l_quantity < 24 - -LIMIT 1; -``` - -##### Q7 - -``` -select - - supp_nation, - - cust_nation, - - l_year, - - sum(volume) as revenue - -from - -( - - select - -​ n1.n_name as supp_nation, - -​ n2.n_name as cust_nation, - -​ extract(year from l_shipdate) as l_year, - -​ l_extendedprice * (1 - l_discount) as volume - - from - -​ supplier, - -​ lineitem, - -​ orders, - -​ customer, - -​ nation n1, - -​ nation n2 - - where - -​ s_suppkey = l_suppkey - -​ and o_orderkey = l_orderkey - -​ and c_custkey = o_custkey - -​ and s_nationkey = n1.n_nationkey - -​ and c_nationkey = n2.n_nationkey - -​ and - -​ ( - -​ (n1.n_name = 'CHINA' and n2.n_name = 'INDONESIA') - -​ or (n1.n_name = 'INDONESIA' and n2.n_name = 'CHINA') - -​ ) - -​ and l_shipdate between date '1995-01-01' and date '1996-12-31' - -) as shipping - -group by - - supp_nation, - - cust_nation, - - l_year - -order by - - supp_nation, - - cust_nation, - - l_year - -LIMIT 1; -``` - -##### Q8 - -``` -select - - o_year, - - sum(case - - when nation = 'INDONESIA' then volume - - else 0 - - end) / sum(volume) as mkt_share - -from - -( - - select - -​ extract(year from o_orderdate) as o_year, - -​ l_extendedprice * (1 - l_discount) as volume, - -​ n2.n_name as nation - -​ from - -​ part, - -​ supplier, - -​ lineitem, - -​ orders, - -​ customer, - -​ nation n1, - -​ nation n2, - -​ region - - where - -​ p_partkey = l_partkey - -​ and s_suppkey = l_suppkey - -​ and l_orderkey = o_orderkey - -​ and o_custkey = c_custkey - -​ and c_nationkey = n1.n_nationkey - -​ and n1.n_regionkey = r_regionkey - -​ and r_name = 'ASIA' - -​ and s_nationkey = n2.n_nationkey - -​ and o_orderdate between date '1995-01-01' and date '1996-12-31' - -​ and p_type = 'PROMO POLISHED TIN' - -) as all_nations - -group by - - o_year - -order by - - o_year - -LIMIT 1; -``` - -##### Q9 - -``` -select - - nation, - - o_year, - - sum(amount) as sum_profit - -from - -( - - select - -​ n_name as nation, - -​ extract(year from o_orderdate) as o_year, - -​ l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount - - from - -​ part, - -​ supplier, - -​ lineitem, - -​ partsupp, - -​ orders, - -​ nation - - where - -​ s_suppkey = l_suppkey - -​ and ps_suppkey = l_suppkey - -​ and ps_partkey = l_partkey - -​ and p_partkey = l_partkey - -​ and o_orderkey = l_orderkey - -​ and s_nationkey = n_nationkey - -​ and p_name like '%thistle%' - -) as profit - -group by - - nation, - - o_year - -order by - - nation, - - o_year desc - -LIMIT 1; -``` - -##### Q10 - -``` -select - - c_custkey, - - c_name, - - sum(l_extendedprice * (1 - l_discount)) as revenue, - - c_acctbal, - - n_name, - - c_address, - - c_phone, - - c_comment - -from - - customer, - - orders, - - lineitem, - - nation - -where - - c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and o_orderdate >= date '1994-06-01' - - and o_orderdate < date '1994-06-01' + interval '3' month - - and l_returnflag = 'R' - - and c_nationkey = n_nationkey - -group by - - c_custkey, - - c_name, - - c_acctbal, - - c_phone, - - n_name, - - c_address, - - c_comment - -order by - - revenue desc - -LIMIT 20; -``` - -##### Q11 - -``` -select - - ps_partkey, - - sum(ps_supplycost * ps_availqty) as value - -from - - partsupp, - - supplier, - - nation - -where - - ps_suppkey = s_suppkey - - and s_nationkey = n_nationkey - - and n_name = 'ALGERIA' - -group by - - ps_partkey having - - sum(ps_supplycost * ps_availqty) > - - ( - -​ select - -​ sum(ps_supplycost * ps_availqty) * 0.0001000000 - -​ from - -​ partsupp, - -​ supplier, - -​ nation - -​ where - -​ ps_suppkey = s_suppkey - -​ and s_nationkey = n_nationkey - -​ and n_name = 'ALGERIA' - - ) - -order by - - value desc - -LIMIT 1; -``` - -##### Q12 - -``` -select - - l_shipmode, - - sum(case when o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' then 1 else 0 end) as high_line_count, - - sum(case when o_orderpriority <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end) as low_line_count - -from - - orders, - - lineitem - -where - - o_orderkey = l_orderkey - - and l_shipmode in ('RAIL', 'SHIP') - - and l_commitdate < l_receiptdate - - and l_shipdate < l_commitdate - - and l_receiptdate >= date '1994-01-01' - - and l_receiptdate < date '1994-01-01' + interval '1' year - -group by - - l_shipmode - -order by - - l_shipmode - -LIMIT 1; -``` - -##### Q13 - -``` -select - - c_count, - - count(*) as custdist - -from - -( - - select - -​ c_custkey, - -​ count(o_orderkey) - - from - -​ customer left outer join orders on - -​ c_custkey = o_custkey - -​ and o_comment not like '%express%packages%' - - group by - -​ c_custkey - -) as c_orders (c_custkey, c_count) - -group by - - c_count - -order by - - custdist desc, - - c_count desc - -LIMIT 1; -``` - -##### Q14 - -``` -select - - 100.00 * sum(case when p_type like 'PROMO%' then l_extendedprice * (1 - l_discount) else 0 end) /sum(l_extendedprice * (1 - l_discount)) as promo_revenue - -from - - lineitem, - - part - -where - - l_partkey = p_partkey - - and l_shipdate >= date '1994-02-01' - - and l_shipdate < date '1994-02-01' + interval '1' month - -LIMIT 1; -``` - -##### 用到的视图 - -``` -create or replace view revenue0 (supplier_no, total_revenue) as - -select - - l_suppkey, - - sum(l_extendedprice * (1 - l_discount)) - -from - - lineitem - -where - - l_shipdate >= date '1994-02-01' - - and l_shipdate < date '1994-02-01' + interval '3' month - -group by - - l_suppkey; -``` - -##### Q15 - -``` -select - - s_suppkey, - - s_name, - - s_address, - - s_phone, - - total_revenue - -from - - supplier, - - revenue0 - -where - - s_suppkey = supplier_no - - and total_revenue = - - ( - -​ select - -​ max(total_revenue) - -​ from - -​ revenue0 - - ) - -order by - - s_suppkey - -LIMIT 1; -``` - -##### Q16 - -``` -select - - p_brand, - - p_type, - - p_size, - - count(distinct ps_suppkey) as supplier_cnt - -from - - partsupp, - - part - -where - - p_partkey = ps_partkey - - and p_brand <> 'Brand#55' - - and p_type not like 'MEDIUM PLATED%' - - and p_size in (35, 17, 43, 49, 19, 41, 30, 47) - - and ps_suppkey not in - - ( - -​ select - -​ s_suppkey - -​ from - -​ supplier - -​ where - -​ s_comment like '%Customer%Complaints%' - - ) - -group by - - p_brand, - - p_type, - - p_size - -order by - - supplier_cnt desc, - - p_brand, - - p_type, - - p_size - -LIMIT 1; -``` - -##### Q17 - -``` -select - - sum(l_extendedprice) / 7.0 as avg_yearly - -from - - lineitem, - - part, - - (SELECT l_partkey AS agg_partkey, 0.2 * avg(l_quantity) AS avg_quantity FROM lineitem GROUP BY l_partkey) part_agg - -where - - p_partkey = l_partkey - - and agg_partkey = l_partkey - - and p_brand = 'Brand#53' - - and p_container = 'JUMBO JAR' - - and l_quantity < avg_quantity - -LIMIT 1; -``` - -#### Q18 - -``` -select - - c_name, - - c_custkey, - - o_orderkey, - - o_orderdate, - - o_totalprice, - - sum(l_quantity) - -from - - customer, - - orders, - - lineitem - -where - - o_orderkey in - - ( - -​ select - -​ l_orderkey - -​ from - -​ lineitem - -​ group by - -​ l_orderkey having - -​ sum(l_quantity) > 313 - - ) - - and c_custkey = o_custkey - - and o_orderkey = l_orderkey - -group by - - c_name, - - c_custkey, - - o_orderkey, - - o_orderdate, - - o_totalprice - -order by - - o_totalprice desc, - - o_orderdate - -LIMIT 100; -``` - -##### Q19 - -``` -select - - sum(l_extendedprice* (1 - l_discount)) as revenue - -from - - lineitem, - - part - -where - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#42' - -​ and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') - -​ and l_quantity >= 6 and l_quantity <= 6 + 10 - -​ and p_size between 1 and 5 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - - or - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#55' - -​ and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') - -​ and l_quantity >= 20 and l_quantity <= 20 + 10 - -​ and p_size between 1 and 10 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - - or - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#24' - -​ and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') - -​ and l_quantity >= 23 and l_quantity <= 23 + 10 - -​ and p_size between 1 and 15 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - -LIMIT 1; -``` - -##### Q20 - -``` -select s_name,s_address - -from supplier,nation - -where - - s_suppkey in - - (select ps_suppkey - -​ from partsupp, - -​ ( - -​ select - -​ l_partkey agg_partkey, - -​ l_suppkey agg_suppkey, - -​ 0.5 * sum(l_quantity) AS agg_quantity - -​ from - -​ lineitem - -​ where - -​ l_shipdate >= date '1997-01-01' - -​ and l_shipdate < date '1997-01-01' + interval '1' year - -​ group by - -​ l_partkey, - -​ l_suppkey - -​ ) agg_lineitem - -​ where - -​ agg_partkey = ps_partkey - -​ and agg_suppkey = ps_suppkey - -​ and ps_partkey in - -​ ( - -​ select - -​ p_partkey - -​ from - -​ part - -​ where - -​ p_name like 'frosted%' - -​ ) - -​ and ps_availqty > agg_quantity - - ) - - and s_nationkey = n_nationkey - - and n_name = 'UNITED STATES' - -order by - - s_name - -LIMIT 1; -``` - -##### Q21 - -``` -select - - s_name, - - count(*) as numwait - -from - - supplier, - - lineitem l1, - - orders, - - nation - -where - - s_suppkey = l1.l_suppkey - - and o_orderkey = l1.l_orderkey - - and o_orderstatus = 'F' - - and l1.l_receiptdate > l1.l_commitdate - - and exists - - ( - -​ select - -​ * - -​ from - -​ lineitem l2 - -​ where - -​ l2.l_orderkey = l1.l_orderkey - -​ and l2.l_suppkey <> l1.l_suppkey - - ) - - and not exists - - ( - -​ select - -​ * - -​ from - -​ lineitem l3 - -​ where - -​ l3.l_orderkey = l1.l_orderkey - -​ and l3.l_suppkey <> l1.l_suppkey - -​ and l3.l_receiptdate > l3.l_commitdate - - ) - - and s_nationkey = n_nationkey - - and n_name = 'VIETNAM' - -group by - - s_name - -order by - - numwait desc, - - s_name - -LIMIT 100; -``` - -##### Q22 - -``` -select - - cntrycode, - - count(*) as numcust, - - sum(c_acctbal) as totacctbal - -from - -( - - select - -​ substring(c_phone from 1 for 2) as cntrycode, - -​ c_acctbal - - from - -​ customer - - where - -​ substring(c_phone from 1 for 2) in - -​ ('34', '18', '30', '24', '33', '22', '29') - -​ and c_acctbal > - -​ ( - -​ select - -​ avg(c_acctbal) - -​ from - -​ customer - -​ where - -​ c_acctbal > 0.00 - -​ and substring(c_phone from 1 for 2) in - -​ ('34', '18', '30', '24', '33', '22', '29') - -​ ) - -​ and not exists - -​ ( - -​ select - -​ * - -​ from - -​ orders - -​ where - -​ o_custkey = c_custkey - -​ ) - -) as custsale - -group by - - cntrycode - -order by - - cntrycode - -LIMIT 1; -``` diff --git a/product/zh/docs-mogdb/v3.0/poc/poc-jiangsumobile.assets/image-20210312105303222.png b/product/zh/docs-mogdb/v3.0/poc/poc-jiangsumobile.assets/image-20210312105303222.png deleted file mode 100644 index 616e33e610b0bca7f20fbef6bea75996c69b2d46..0000000000000000000000000000000000000000 Binary files a/product/zh/docs-mogdb/v3.0/poc/poc-jiangsumobile.assets/image-20210312105303222.png and /dev/null differ diff --git a/product/zh/docs-mogdb/v3.0/poc/poc-jiangsumobile.assets/image-20210312105352146.png b/product/zh/docs-mogdb/v3.0/poc/poc-jiangsumobile.assets/image-20210312105352146.png deleted file mode 100644 index 7d8d8d38fe5770b45b9a0b17ef3a9208d55d9133..0000000000000000000000000000000000000000 Binary files a/product/zh/docs-mogdb/v3.0/poc/poc-jiangsumobile.assets/image-20210312105352146.png and /dev/null differ diff --git a/product/zh/docs-mogdb/v3.0/poc/poc-jiangsumobile.md b/product/zh/docs-mogdb/v3.0/poc/poc-jiangsumobile.md deleted file mode 100644 index e8930d403a51548730c386926acd139bc98f44a6..0000000000000000000000000000000000000000 --- a/product/zh/docs-mogdb/v3.0/poc/poc-jiangsumobile.md +++ /dev/null @@ -1,1618 +0,0 @@ -# 某省移动MogDB 1.1.0版本测试报告 - -## POC前准备工作 - -### 操作系统版本及下载地址 - -| 介质名称 | 介质大小 | 最后更新时间 | -| ------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------- | -| [openEuler-20.03-LTS-aarch64-dvd.iso](https://repo.openeuler.org/openEuler-20.03-LTS/ISO/aarch64/openEuler-20.03-LTS-aarch64-dvd.iso) | 4.3 GiB | 2020-Mar-26 14:46 | - -#### 用户名和组 - -| 组名 | 组ID | 用途 | -| --------- | -------- | ------------- | -| root | 0 | administrator | -| bomc | 1302 | 网管 | -| osmgr | 1800 | OS管理 | -| xtjgmons | 5000 | 系统维护 | -| ==dbgrp== | ==5002== | ==MogDB== | - -| 用户名 | 用户ID | 所属用户组 | Home目录 | Shell | 用途 | -| -------- | -------- | ---------- | ------------- | --------- | ----------------- | -| root | 0 | root | /root | /bin/bash | administrator | -| toptea | 1302 | bomc | /toptea | /bin/bash | 网管 | -| osmgr | 1800 | osmgr | /home/osmgr | /bin/bash | OS管理 | -| dutyview | 5000 | xtjgmons | 5000 | 无 | 无 | -| dutywath | 5001 | xtjgmons | 5000 | 无 | 无 | -| ==omm== | ==5002== | ==dbgrp== | ====/home/omm | 无 | ==MogDB==系统用户 | - -### 本地盘划分 - -| lv卷名 | 文件系统 | 大小 | 属组 | 权限 | 系统格式 | 用途 | -| ------------------ | ---------- | ---- | ----- | ---- | -------- | -------------------------------------------------------- | -| vg_og/lv_ogdata | /ogdata | 2T | dbgrp | 755 | ext4 | datapath 存放数据文件 | -| vg_og/lv_ogxlog | /ogxlog | 500G | dbgrp | 755 | ext4 | 存放redo日志 | -| vg_og/lv_ogarchive | /ogarchive | 1T | dbgrp | 755 | ext4 | 存放归档日志 | -| rootvg | /mogdb | 200G | dbgrp | 755 | ext4 | 存放数据库二进制、日志、临时文件、socket文件、om维护命令 | -| vg_og/lv_ogbackup | /og_bak | 6T | dbgrp | 755 | ext4 | 存放数据备份 | - -## 服务器配置 - -| 机房位置 | 机架位置 | 设备数量 | 设备型号 | -| ------------ | --------- | -------- | ------------ | -| 浦口高新机房 | C11(2台) | 2 | 华为100 T130 | - -| 型号 | CPU | 内存 | 硬盘 | 数量 | -| ----------- | ------------------ | ---- | --------------------------------------------------------- | ---- | -| 华为100 T30 | 鲲鹏920 (48core)*2 | 384G | OS盘: 2块600G SAS RAID1
数据盘: 6块3.2T SSD RAID5 | 2台 | - -## IP地址 - -| 设备 | 主机名 | 主机型号 | 机柜 | 管理地址 | 业务地址 | -| ---- | -------- | ------------ | ---- | ------------- | ------------- | -| 华为 | npromgs3 | 华为100 T130 | C11 | 190.168.80.79 | 10.32.225.150 | -| 华为 | npromgs4 | 华为100 T130 | C11 | 190.168.80.80 | 10.32.225.151 | - -## 操作系统版本 - -``` -openEuler 20.3LTS -## -``` - -## 数据库信息 - -### 数据库版本 - -``` -gsql ((MogDB 1.1.0 build 5be05d82) compiled at 2021-01-06 17:23:14 commit 0 last mr ) -``` - -### 数据库主备信息 - -| 主库 | IP: 10.32.225.150 | 读写 | -| ---- | ----------------- | ---- | -| 备库 | IP: 10.32.225.151 | 只读 | - -## 测试结果所在目录 - -### IP: 10.32.225.150 - -| 测试项 | 目录 | -| -------------- | ---------------------------------- | -| 测试用例及日志 | /og_bak | -| TPCC测试及日志 | /root/benchmarksql-5.0/run/tpcclog | - -## 功能测试 - -### 兼容性 - -| 测试项 | 测试结果 | 说明 | -| --------------- | -------- | -------------------------------------------------------------------------------------------------------------- | -| 数据类型 | 通过 | 对于数值类型 字符类型 二进制类型 日期类型 布尔类型 时间间隔类型 数组类型 json类型等常用数据类型支持情况。 | -| 字符集 | 通过 | 支持utf-8(MySQL中应为utf8mb4),gbk等常见字符格式类型 | -| 基本SQL语法 | 通过 | 增删改查操作 | -| 复杂SQL | 通过 | 多种连接查询,包括交叉连接、自然连接、jion…using、jion..on、自连接、内连接、外连接 | -| 常用函数 | 通过 | union、union all、intersect等集合操作符 | -| 操作符 | 通过 | 逻辑操作符and or not | -| SQL语法及兼容性 | 通过 | commit/rollback/grant等DCL操作 | -| 其他高级SQL兼容 | 通过 | on duplicate key update、WITH RECURSIVE(start with … connect、with as、lock table、create table if not exists | -| 数据分区 | 通过 | 测试范围分区: 支持增加、拆分、合并、交换、删除分区 | -| 索引管理 | 通过 | 创建表并创建普通索引 | -| 约束 | 通过 | 创建表并创建约束 | -| 事务一致性 | 通过 | 原子性、一致性、隔离性、持久性特性 | -| mvcc | 通过 | 写之间不阻塞。SELECT是纯读操作,UPDATE和DELETE是读写操作。 | -| mot | 通过 | 内存表 | - -### 优化器 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ----------------------------- | -| 执行计划解析 | 通过 | 能够显式展现SQL语句的执行计划 | -| hint | 通过 | 能够支持加hint | -| 查询转换 | 通过 | 支持查询转换 | - -### 高级功能 - -| 测试项 | 测试结果 | 说明 | -| -------- | -------- | ---------------------------------------- | -| 存储过程 | 通过 | 测试存储过程的基本功能和过程中的控制语句 | -| 函数 | 通过 | 测试存储函数的创建和删除操作 | -| 视图 | 通过 | 支持视图建立、修改、删除 | -| 游标 | 通过 | 测试定义并使用引用游标 | -| 触发器 | 通过 | 测试insert/update/delete/instead of | -| 序列 | 通过 | 创建并使用序列、获取序列当前值和下一值 | - -## 安全性测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ------------------------------------------------------------ | -| 用户权限管理 | 通过 | 权限管理 | -| 角色权限管理 | 通过 | 角色管理 | -| 身份鉴别 | 通过 | 配置密码复杂度检查,密码的不可重用天数,帐户登录失败尝试次数 | -| 审计日志 | 通过 | 记录用户登录退出的审计日志 | - -## 高可用测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | ---------------------------------------------------- | -| 读写分离 | 通过 | 主库建测试表,备库去读取内容 | -| 保护模式配置 | 通过 | 通过参数控制保护模式,同步模式(同步,异步,半同步) | - -## 备份恢复测试 - -| 测试项 | 测试结果 | 说明 | -| ---------------------- | -------- | -------------------------------------------------------------------------------- | -| 物理备份全量备份和恢复 | 通过 | 主库建测试表,备库去读取内容 | -| 逻辑备份和恢复 | 通过 | 是否支持在线逻辑备份,验证备份后数据恢复正确性和效率,在线备份期间对性能的影响。 | - -## 运维管理测试 - -| 测试项 | 测试结果 | 说明 | -| ------------ | -------- | --------------------------------------------------------------------------- | -| 报错信息 | 通过 | [errorcode](https://support.huaweicloud.com/errorcode-dws/dws_08_0001.html) | -| 性能视图 | 通过 | 和数据库相关的性能视图 | -| 性能分析报告 | 通过 | WDR类似Oracle AWR | -| 慢SQL视图 | 通过 | | -| 日志管理 | 通过 | 系统日志,操作日志,Trace日志,黑匣子日志,审计日志,WAL日志,性能日志。 | -| 监控运维 | 通过 | 常用的运维和定位问题手段 | - -## 性能测试 - -### TPCC - -#### 测试工具BenchmarkSQL v5.0及参数 - -| 序号 | 参数名称 | 值 | -| ---- | ---------- | -------------------------------------------- | -| 1 | db | postgres | -| 2 | driver | org.postgresql.Driver | -| 3 | conn | jdbc:postgresql://10.32.225.150:6432/tpcctst | -| 4 | user | tpccuser | -| 5 | warehouses | 10000 | - -> 说明:数据总容量大约100GB - -#### 测试用表的数据量 - -| 序号 | 表名 | 数据总数 | -| ---- | ---------------- | -------------------- | -| 1 | bmsql_config | 4 | -| 2 | bmsql_custome | 30014788 | -| 3 | bmsql_district | 10000 | -| 4 | bmsql_history | 29996623 | -| 5 | bmsql_item | 100000 | -| 6 | bmsql_new_order | 9000105 | -| 7 | bmsql_oorder | 29995891 | -| 8 | bmsql_order_line | 299981583(约1.9亿) | -| 9 | bmsql_stock | 100002396(约1亿) | -| 10 | bmsql_warehouse | 1000 | - -#### 测试结果 - -| 并发 | 时长(分钟) | tpmC (NewOrders) | -| ---- | ------------ | ------------------ | -| 400 | 1 | 383010.44 | -| 400 | 2 | 396593.65 | -| 400 | 5 | 366825.72 | -| 400 | 10 | 369191.96 | - -### TPCH - -#### 测试用表的数据量 - -##### 工具导入3GB数据 - -![image-20210312105303222](https://cdn-mogdb.enmotech.com/docs-media/111.png) - -##### 工具导入 TPC-H 30G 数据 - -![image-20210312105352146](https://cdn-mogdb.enmotech.com/docs-media/115.png) - -#### 测试结果 - -| 查询语句说明 | Query ID | 3GB数据 | 30GB数据 | -| ------------------------------------------------ | -------- | ------------ | ------------- | -| 价格统计报告查询 | Q1 | 86290.621 ms | 867229.922 ms | -| 最小代价供货商查询 | Q2 | 1588.686 ms | 29948.139 ms | -| 运送优先级查询 | Q3 | 9930.242 ms | 153179.243 ms | -| 订单优先级查询 | Q4 | 2413.140 ms | 29535.320 ms | -| 某地区供货商为公司带来的收入查询 | Q5 | 12687.063 ms | 146917.921 ms | -| 预测收入变化查询 | Q6 | 3381.666 ms | 77716.338 ms | -| 货运盈利情况查询 | Q7 | 6423.072 ms | 142928.852 ms | -| 国家市场份额查询 | Q8 | 7985.378 ms | 103726.748 ms | -| 产品类型利润估量查询 | Q9 | 28462.979 ms | 366562.292 ms | -| 货运存在问题的查询 | Q10 | 10098.798 ms | 149445.271 ms | -| 库存价值查询 | Q11 | 1915.023 ms | 23855.269 ms | -| 货运模式和订单优先级查询 | Q12 | 11048.061 ms | 119823.533 ms | -| 消费者订单数量查询 | Q13 | 9149.003 ms | 116618.514 ms | -| 促销效果查询 | Q14 | 1024.503 ms | 29369.667 ms | -| 查询获得某段时间内为总收入贡献最多的供货商的信息 | Q15 | 3011.973 ms | 101147.519 ms | -| 零件/供货商关系查询 | Q16 | 2253.134 ms | 28748.335 ms | -| 小订单收入查询 | Q17 | 35671.622 ms | 420488.742 ms | -| 大订单顾客查询 | Q18 | 30810.445 ms | 461710.335 ms | -| 折扣收入查询 | Q19 | 10483.329 ms | 107313.130 ms | -| 供货商竞争力查询 | Q20 | 7903.905 ms | 161276.226 ms | -| 不能按时交货供货商查询 | Q21 | 20424.039 ms | 264827.982 ms | -| 全球销售机会查询 | Q22 | 3458.196 ms | 50860.840 ms | - -#### TPCH测试SQL - -##### Q1 - -``` -select - - l_returnflag, - - l_linestatus, - - sum(l_quantity) as sum_qty, - - sum(l_extendedprice) as sum_base_price, - - sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, - - sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, - - avg(l_quantity) as avg_qty, - - avg(l_extendedprice) as avg_price, - - avg(l_discount) as avg_disc, - - count(*) as count_order - -from - - lineitem - -where - - l_shipdate <= date '1998-12-01' - interval '103' day - -group by - - l_returnflag, - - l_linestatus - -order by - - l_returnflag, - - l_linestatus - -LIMIT 1; -``` - -##### Q2 - -``` -select - - s_acctbal, - - s_name, - - n_name, - - p_partkey, - - p_mfgr, - - s_address, - - s_phone, - - s_comment - -from - - part, - - supplier, - - partsupp, - - nation, - - region, - - ( - -​ select - -​ ps_partkey, - -​ min(ps_supplycost) as min - -​ from - -​ partsupp, - -​ supplier, - -​ nation, - -​ region - -​ where - -​ s_suppkey = ps_suppkey - -​ and s_nationkey = n_nationkey - -​ and n_regionkey = r_regionkey - -​ and r_name = 'EUROPE' - -​ group by - -​ ps_partkey - - ) temp - -where - - p_partkey = partsupp.ps_partkey - - and s_suppkey = ps_suppkey - - and p_size = 47 - - and p_type like '%BRASS' - - and s_nationkey = n_nationkey - - and n_regionkey = r_regionkey - - and r_name = 'EUROPE' - - and ps_supplycost = temp.min - - and p_partkey = temp.ps_partkey - -order by - - s_acctbal desc, - - n_name, - - s_name, - - p_partkey - -LIMIT 100; -``` - -#### Q3 - -``` -select - - l_orderkey, - - sum(l_extendedprice * (1 - l_discount)) as revenue, - - o_orderdate, - - o_shippriority - -from - - customer, - - orders, - - lineitem - -where - - c_mktsegment = 'BUILDING' - - and c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and o_orderdate < date '1995-03-20' - - and l_shipdate > date '1995-03-20' - -group by - - l_orderkey, - - o_orderdate, - - o_shippriority - -order by - - revenue desc, - - o_orderdate - -LIMIT 10; -``` - -##### Q4 - -``` -select - - o_orderpriority, - - count(*) as order_count - -from - - orders - -where - - o_orderdate >= date '1995-12-01' - - and o_orderdate < date '1995-12-01' + interval '3' month - - and exists - - ( - -​ select - -​ * - -​ from - -​ lineitem - -​ where - -​ l_orderkey = o_orderkey - -​ and l_commitdate < l_receiptdate - -​ limit 1 - - ) - -group by - - o_orderpriority - -order by - - o_orderpriority - -LIMIT 1; -``` - -##### Q5 - -``` -select - - n_name, - - sum(l_extendedprice * (1 - l_discount)) as revenue - -from - - customer, - - orders, - - lineitem, - - supplier, - - nation, - - region - -where - - c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and l_suppkey = s_suppkey - - and c_nationkey = s_nationkey - - and s_nationkey = n_nationkey - - and n_regionkey = r_regionkey - - and r_name = 'AMERICA' - - and o_orderdate >= date '1997-01-01' - - and o_orderdate < date '1997-01-01' + interval '1' year - -group by - - n_name - -order by - - revenue desc - -LIMIT 1; -``` - -##### Q6 - -``` -select - - sum(l_extendedprice * l_discount) as revenue - -from - - lineitem - -where - - l_shipdate >= date '1997-01-01' - - and l_shipdate < date '1997-01-01' + interval '1' year - - and l_discount between 0.07 - 0.01 and 0.07 + 0.01 - - and l_quantity < 24 - -LIMIT 1; -``` - -##### Q7 - -``` -select - - supp_nation, - - cust_nation, - - l_year, - - sum(volume) as revenue - -from - -( - - select - -​ n1.n_name as supp_nation, - -​ n2.n_name as cust_nation, - -​ extract(year from l_shipdate) as l_year, - -​ l_extendedprice * (1 - l_discount) as volume - - from - -​ supplier, - -​ lineitem, - -​ orders, - -​ customer, - -​ nation n1, - -​ nation n2 - - where - -​ s_suppkey = l_suppkey - -​ and o_orderkey = l_orderkey - -​ and c_custkey = o_custkey - -​ and s_nationkey = n1.n_nationkey - -​ and c_nationkey = n2.n_nationkey - -​ and - -​ ( - -​ (n1.n_name = 'CHINA' and n2.n_name = 'INDONESIA') - -​ or (n1.n_name = 'INDONESIA' and n2.n_name = 'CHINA') - -​ ) - -​ and l_shipdate between date '1995-01-01' and date '1996-12-31' - -) as shipping - -group by - - supp_nation, - - cust_nation, - - l_year - -order by - - supp_nation, - - cust_nation, - - l_year - -LIMIT 1; -``` - -##### Q8 - -``` -select - - o_year, - - sum(case - - when nation = 'INDONESIA' then volume - - else 0 - - end) / sum(volume) as mkt_share - -from - -( - - select - -​ extract(year from o_orderdate) as o_year, - -​ l_extendedprice * (1 - l_discount) as volume, - -​ n2.n_name as nation - -​ from - -​ part, - -​ supplier, - -​ lineitem, - -​ orders, - -​ customer, - -​ nation n1, - -​ nation n2, - -​ region - - where - -​ p_partkey = l_partkey - -​ and s_suppkey = l_suppkey - -​ and l_orderkey = o_orderkey - -​ and o_custkey = c_custkey - -​ and c_nationkey = n1.n_nationkey - -​ and n1.n_regionkey = r_regionkey - -​ and r_name = 'ASIA' - -​ and s_nationkey = n2.n_nationkey - -​ and o_orderdate between date '1995-01-01' and date '1996-12-31' - -​ and p_type = 'PROMO POLISHED TIN' - -) as all_nations - -group by - - o_year - -order by - - o_year - -LIMIT 1; -``` - -##### Q9 - -``` -select - - nation, - - o_year, - - sum(amount) as sum_profit - -from - -( - - select - -​ n_name as nation, - -​ extract(year from o_orderdate) as o_year, - -​ l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount - - from - -​ part, - -​ supplier, - -​ lineitem, - -​ partsupp, - -​ orders, - -​ nation - - where - -​ s_suppkey = l_suppkey - -​ and ps_suppkey = l_suppkey - -​ and ps_partkey = l_partkey - -​ and p_partkey = l_partkey - -​ and o_orderkey = l_orderkey - -​ and s_nationkey = n_nationkey - -​ and p_name like '%thistle%' - -) as profit - -group by - - nation, - - o_year - -order by - - nation, - - o_year desc - -LIMIT 1; -``` - -##### Q10 - -``` -select - - c_custkey, - - c_name, - - sum(l_extendedprice * (1 - l_discount)) as revenue, - - c_acctbal, - - n_name, - - c_address, - - c_phone, - - c_comment - -from - - customer, - - orders, - - lineitem, - - nation - -where - - c_custkey = o_custkey - - and l_orderkey = o_orderkey - - and o_orderdate >= date '1994-06-01' - - and o_orderdate < date '1994-06-01' + interval '3' month - - and l_returnflag = 'R' - - and c_nationkey = n_nationkey - -group by - - c_custkey, - - c_name, - - c_acctbal, - - c_phone, - - n_name, - - c_address, - - c_comment - -order by - - revenue desc - -LIMIT 20; -``` - -##### Q11 - -``` -select - - ps_partkey, - - sum(ps_supplycost * ps_availqty) as value - -from - - partsupp, - - supplier, - - nation - -where - - ps_suppkey = s_suppkey - - and s_nationkey = n_nationkey - - and n_name = 'ALGERIA' - -group by - - ps_partkey having - - sum(ps_supplycost * ps_availqty) > - - ( - -​ select - -​ sum(ps_supplycost * ps_availqty) * 0.0001000000 - -​ from - -​ partsupp, - -​ supplier, - -​ nation - -​ where - -​ ps_suppkey = s_suppkey - -​ and s_nationkey = n_nationkey - -​ and n_name = 'ALGERIA' - - ) - -order by - - value desc - -LIMIT 1; -``` - -##### Q12 - -``` -select - - l_shipmode, - - sum(case when o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' then 1 else 0 end) as high_line_count, - - sum(case when o_orderpriority <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1 else 0 end) as low_line_count - -from - - orders, - - lineitem - -where - - o_orderkey = l_orderkey - - and l_shipmode in ('RAIL', 'SHIP') - - and l_commitdate < l_receiptdate - - and l_shipdate < l_commitdate - - and l_receiptdate >= date '1994-01-01' - - and l_receiptdate < date '1994-01-01' + interval '1' year - -group by - - l_shipmode - -order by - - l_shipmode - -LIMIT 1; -``` - -##### Q13 - -``` -select - - c_count, - - count(*) as custdist - -from - -( - - select - -​ c_custkey, - -​ count(o_orderkey) - - from - -​ customer left outer join orders on - -​ c_custkey = o_custkey - -​ and o_comment not like '%express%packages%' - - group by - -​ c_custkey - -) as c_orders (c_custkey, c_count) - -group by - - c_count - -order by - - custdist desc, - - c_count desc - -LIMIT 1; -``` - -##### Q14 - -``` -select - - 100.00 * sum(case when p_type like 'PROMO%' then l_extendedprice * (1 - l_discount) else 0 end) /sum(l_extendedprice * (1 - l_discount)) as promo_revenue - -from - - lineitem, - - part - -where - - l_partkey = p_partkey - - and l_shipdate >= date '1994-02-01' - - and l_shipdate < date '1994-02-01' + interval '1' month - -LIMIT 1; -``` - -##### 用到的视图 - -``` -create or replace view revenue0 (supplier_no, total_revenue) as - -select - - l_suppkey, - - sum(l_extendedprice * (1 - l_discount)) - -from - - lineitem - -where - - l_shipdate >= date '1994-02-01' - - and l_shipdate < date '1994-02-01' + interval '3' month - -group by - - l_suppkey; -``` - -##### Q15 - -``` -select - - s_suppkey, - - s_name, - - s_address, - - s_phone, - - total_revenue - -from - - supplier, - - revenue0 - -where - - s_suppkey = supplier_no - - and total_revenue = - - ( - -​ select - -​ max(total_revenue) - -​ from - -​ revenue0 - - ) - -order by - - s_suppkey - -LIMIT 1; -``` - -##### Q16 - -``` -select - - p_brand, - - p_type, - - p_size, - - count(distinct ps_suppkey) as supplier_cnt - -from - - partsupp, - - part - -where - - p_partkey = ps_partkey - - and p_brand <> 'Brand#55' - - and p_type not like 'MEDIUM PLATED%' - - and p_size in (35, 17, 43, 49, 19, 41, 30, 47) - - and ps_suppkey not in - - ( - -​ select - -​ s_suppkey - -​ from - -​ supplier - -​ where - -​ s_comment like '%Customer%Complaints%' - - ) - -group by - - p_brand, - - p_type, - - p_size - -order by - - supplier_cnt desc, - - p_brand, - - p_type, - - p_size - -LIMIT 1; -``` - -##### Q17 - -``` -select - - sum(l_extendedprice) / 7.0 as avg_yearly - -from - - lineitem, - - part, - - (SELECT l_partkey AS agg_partkey, 0.2 * avg(l_quantity) AS avg_quantity FROM lineitem GROUP BY l_partkey) part_agg - -where - - p_partkey = l_partkey - - and agg_partkey = l_partkey - - and p_brand = 'Brand#53' - - and p_container = 'JUMBO JAR' - - and l_quantity < avg_quantity - -LIMIT 1; -``` - -#### Q18 - -``` -select - - c_name, - - c_custkey, - - o_orderkey, - - o_orderdate, - - o_totalprice, - - sum(l_quantity) - -from - - customer, - - orders, - - lineitem - -where - - o_orderkey in - - ( - -​ select - -​ l_orderkey - -​ from - -​ lineitem - -​ group by - -​ l_orderkey having - -​ sum(l_quantity) > 313 - - ) - - and c_custkey = o_custkey - - and o_orderkey = l_orderkey - -group by - - c_name, - - c_custkey, - - o_orderkey, - - o_orderdate, - - o_totalprice - -order by - - o_totalprice desc, - - o_orderdate - -LIMIT 100; -``` - -##### Q19 - -``` -select - - sum(l_extendedprice* (1 - l_discount)) as revenue - -from - - lineitem, - - part - -where - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#42' - -​ and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') - -​ and l_quantity >= 6 and l_quantity <= 6 + 10 - -​ and p_size between 1 and 5 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - - or - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#55' - -​ and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') - -​ and l_quantity >= 20 and l_quantity <= 20 + 10 - -​ and p_size between 1 and 10 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - - or - - ( - -​ p_partkey = l_partkey - -​ and p_brand = 'Brand#24' - -​ and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') - -​ and l_quantity >= 23 and l_quantity <= 23 + 10 - -​ and p_size between 1 and 15 - -​ and l_shipmode in ('AIR', 'AIR REG') - -​ and l_shipinstruct = 'DELIVER IN PERSON' - - ) - -LIMIT 1; -``` - -##### Q20 - -``` -select s_name,s_address - -from supplier,nation - -where - - s_suppkey in - - (select ps_suppkey - -​ from partsupp, - -​ ( - -​ select - -​ l_partkey agg_partkey, - -​ l_suppkey agg_suppkey, - -​ 0.5 * sum(l_quantity) AS agg_quantity - -​ from - -​ lineitem - -​ where - -​ l_shipdate >= date '1997-01-01' - -​ and l_shipdate < date '1997-01-01' + interval '1' year - -​ group by - -​ l_partkey, - -​ l_suppkey - -​ ) agg_lineitem - -​ where - -​ agg_partkey = ps_partkey - -​ and agg_suppkey = ps_suppkey - -​ and ps_partkey in - -​ ( - -​ select - -​ p_partkey - -​ from - -​ part - -​ where - -​ p_name like 'frosted%' - -​ ) - -​ and ps_availqty > agg_quantity - - ) - - and s_nationkey = n_nationkey - - and n_name = 'UNITED STATES' - -order by - - s_name - -LIMIT 1; -``` - -##### Q21 - -``` -select - - s_name, - - count(*) as numwait - -from - - supplier, - - lineitem l1, - - orders, - - nation - -where - - s_suppkey = l1.l_suppkey - - and o_orderkey = l1.l_orderkey - - and o_orderstatus = 'F' - - and l1.l_receiptdate > l1.l_commitdate - - and exists - - ( - -​ select - -​ * - -​ from - -​ lineitem l2 - -​ where - -​ l2.l_orderkey = l1.l_orderkey - -​ and l2.l_suppkey <> l1.l_suppkey - - ) - - and not exists - - ( - -​ select - -​ * - -​ from - -​ lineitem l3 - -​ where - -​ l3.l_orderkey = l1.l_orderkey - -​ and l3.l_suppkey <> l1.l_suppkey - -​ and l3.l_receiptdate > l3.l_commitdate - - ) - - and s_nationkey = n_nationkey - - and n_name = 'VIETNAM' - -group by - - s_name - -order by - - numwait desc, - - s_name - -LIMIT 100; -``` - -##### Q22 - -``` -select - - cntrycode, - - count(*) as numcust, - - sum(c_acctbal) as totacctbal - -from - -( - - select - -​ substring(c_phone from 1 for 2) as cntrycode, - -​ c_acctbal - - from - -​ customer - - where - -​ substring(c_phone from 1 for 2) in - -​ ('34', '18', '30', '24', '33', '22', '29') - -​ and c_acctbal > - -​ ( - -​ select - -​ avg(c_acctbal) - -​ from - -​ customer - -​ where - -​ c_acctbal > 0.00 - -​ and substring(c_phone from 1 for 2) in - -​ ('34', '18', '30', '24', '33', '22', '29') - -​ ) - -​ and not exists - -​ ( - -​ select - -​ * - -​ from - -​ orders - -​ where - -​ o_custkey = c_custkey - -​ ) - -) as custsale - -group by - - cntrycode - -order by - - cntrycode - -LIMIT 1; -```