# 工具简介和说明
`sys_workload_profile`是Kingbase数据库下精准刻画工作负载应用场景的一款工具,其目的在于:
1. 支持预先定义好的特征信息提取
2. 支持用户自定义的特征信息提取
通常情况下,参考TPCC的场景描述可以满足大部分需求,我们将这部分内容做预定义提取,提供给用户;同时考虑到用户可能的自定义提取,我们也将提供中间表给用户使用。
其主要作用:
1. 描述典型性能场景,为产品的将来规划做支撑
2. 简化收集工作,为分库分表 读写分离等建议性工具提供数据支撑,同时节省时间及人力成本
***
其中workload数据是指:工作负载涉及到的表的属性及sys\_statistics信息等。特征提取分析基本步骤如下:

***
# 工具安装和使用
## 安装数据库
创建kingbase用户:
```sql
[root@local64 ~]# useradd kingbase
[root@local64 ~]# passwd kingbase
Changing password for user kingbase.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@local64 ~]#
[root@local64 ~]# vim /etc/sudoers
[root@local64 ~]#
kingbase ALL=(ALL) ALL
```
1. 软件程序下载:<https://www.kingbase.com.cn/rjcxxz/index.htm>
2. 授权文件下载:<https://www.kingbase.com.cn/sqwjxz/index.htm>
***
根据你的环境选择对应安装包及临时license,如下:

```sql
[kingbase@local64 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 59G 31G 28G 53% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 9.0M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 1014M 179M 836M 18% /boot
/dev/mapper/centos-home 128G 40G 88G 32% /home
tmpfs 378M 4.0K 378M 1% /run/user/42
tmpfs 378M 52K 378M 1% /run/user/1005
[kingbase@local64 ~]$
[kingbase@local64 ~]$ wget https://kingbase.oss-cn-beijing.aliyuncs.com/KESV8R3/V008R006C007B0024/KingbaseES_V008R006C007B0024_Lin64_install.iso
--2023-05-25 11:28:29-- https://kingbase.oss-cn-beijing.aliyuncs.com/KESV8R3/V008R006C007B0024/KingbaseES_V008R006C007B0024_Lin64_install.iso
Resolving kingbase.oss-cn-beijing.aliyuncs.com (kingbase.oss-cn-beijing.aliyuncs.com)... 59.110.117.150
Connecting to kingbase.oss-cn-beijing.aliyuncs.com (kingbase.oss-cn-beijing.aliyuncs.com)|59.110.117.150|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2668978176 (2.5G) [application/octet-stream]
Saving to: ‘KingbaseES_V008R006C007B0024_Lin64_install.iso’
100%[=======================================================================================================================================================================>] 2,668,978,176 16.7MB/s in 3m 21s
2023-05-25 11:31:50 (12.7 MB/s) - ‘KingbaseES_V008R006C007B0024_Lin64_install.iso’ saved [2668978176/2668978176]
[kingbase@local64 ~]$ wget https://kingbase.oss-cn-beijing.aliyuncs.com/KESV8R3/license_%E4%BC%81%E4%B8%9A%E7%89%88.zip
--2023-05-25 11:32:02-- https://kingbase.oss-cn-beijing.aliyuncs.com/KESV8R3/license_%E4%BC%81%E4%B8%9A%E7%89%88.zip
Resolving kingbase.oss-cn-beijing.aliyuncs.com (kingbase.oss-cn-beijing.aliyuncs.com)... 59.110.117.150
Connecting to kingbase.oss-cn-beijing.aliyuncs.com (kingbase.oss-cn-beijing.aliyuncs.com)|59.110.117.150|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2735 (2.7K) [application/zip]
Saving to: ‘license_企业版.zip’
100%[=========================================================================================================================================================================>] 2,735 --.-K/s in 0s
2023-05-25 11:32:02 (19.6 MB/s) - ‘license_企业版.zip’ saved [2735/2735]
[kingbase@local64 ~]$ ls
Desktop Documents Downloads KingbaseES_V008R006C007B0024_Lin64_install.iso license_企业版.zip Music Pictures Public Templates Videos
[kingbase@local64 ~]$
```
```sql
[kingbase@local64 ~]$ sudo mkdir -p /mnt/cdrom
[kingbase@local64 ~]$ sudo mount ./KingbaseES_V008R006C007B0024_Lin64_install.iso /mnt/cdrom
mount: /dev/loop1 is write-protected, mounting read-only
[kingbase@local64 ~]$ ls /mnt/cdrom/
setup setup.sh
[kingbase@local64 ~]$
[kingbase@local64 ~]$ sudo cp -r /mnt/cdrom/* ./
[kingbase@local64 ~]$ ls
Desktop Documents Downloads KingbaseES_V008R006C007B0024_Lin64_install.iso license_企业版.zip Music Pictures Public setup setup.sh Templates Videos
[kingbase@local64 ~]$
```
```sql
[kingbase@local64 ~]$ sudo chown kingbase:kingbase setup
[kingbase@local64 ~]$ sudo chown kingbase:kingbase setup.sh
[kingbase@local64 ~]$
[kingbase@local64 ~]$ sudo chown kingbase:kingbase setup/*
[kingbase@local64 ~]$
[kingbase@local64 ~]$ ll setup
total 2606072
-r-xr-xr-x 1 kingbase kingbase 2668607786 May 25 11:40 install.bin
-r-xr-xr-x 1 kingbase kingbase 46 May 25 11:40 MD5
-r--r--r-- 1 kingbase kingbase 1418 May 25 11:40 silent.cfg
[kingbase@local64 ~]$
```
下面安装数据库,如下:
```sql
[kingbase@local64 ~]$ ./setup.sh
...
```

注:图形化安装界面需要java环境,如上图所示!
安装完成,数据库版本,如下:
```sql
kingbase=# select version();
version
----------------------------------------------------------------------------------------------------------------------
KingbaseES V008R006C007B0024 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28), 64-bit
(1 row)
kingbase=# select commercial_version();
commercial_version
---------------------------------------------------------------------------------------------------------
KingbaseES V8.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28), 64-bit
(1 row)
kingbase=#
```
***
## 安装扩展
```sql
[kingbase@local64 bin]$ ./ksql
ksql (V8.0)
Type "help" for help.
kingbase=# create extension sys_workload_profile ;
CREATE EXTENSION
kingbase=# \dx sys_workload_profile
List of installed extensions
Name | Version | Schema | Description
----------------------+---------+--------------+-------------------
sys_workload_profile | 1.0 | sys_workload | workload profiler
(1 row)
kingbase=# \dx+ sys_workload_profile
Objects in extension "sys_workload_profile"
Object description
-------------------------------------------------------
function alter_system_reset_variable(text)
function alter_system_set_variable(text,text)
function remove_extra_blank_char(text)
function save_workload_to_file(text,text)
function split_duration_and_statement(text)
function workload_analyze_report()
function workload_capture_init()
function workload_capture_stop()
function workload_line(text,text)
function workload_split_long_sql(text,integer,bigint)
(10 rows)
kingbase=#
```
## 扩展使用
```sql
-- 处理 负载特征提取 的准备工作
kingbase=# select workload_capture_init();
workload_capture_init
-----------------------
t
(1 row)
kingbase=#
```
```sql
[kingbase@local64 sys_log]$ pwd
/home/kingbase/release/KESRealPro/V008R006C007B0024/Server/bin/test/sys_log
[kingbase@local64 sys_log]$
[kingbase@local64 sys_log]$ ll
total 4
-rw------- 1 kingbase kingbase 770 May 25 15:12 kingbase-2023-05-25_151139.log
-rw------- 1 kingbase kingbase 0 May 25 15:12 sys_workload_2023-05-25_151207.csv
-rw------- 1 kingbase kingbase 0 May 25 15:12 sys_workload_2023-05-25_151207.log
[kingbase@local64 sys_log]$
```
```sql
kingbase=# create table t1 (a int);
CREATE TABLE
kingbase=# insert into t1 select generate_series(1,20);
INSERT 0 20
kingbase=# create table t1_id (a int, id serial);
CREATE TABLE
kingbase=# insert into t1_id select a from t1;
INSERT 0 20
kingbase=# begin transaction ;
BEGIN
kingbase=# select count(*) from t1 where a < 100;
count
-------
20
(1 row)
kingbase=# select count(*) from t1 where a > 200;
count
-------
0
(1 row)
kingbase=# commit ;
COMMIT
kingbase=# begin transaction ;
BEGIN
kingbase=# select count(*) from t1 where a < 100;
count
-------
20
(1 row)
kingbase=# select count(*) from t1 where a < 200;
count
-------
20
(1 row)
kingbase=# select count(*) from t1 where a > 200;
count
-------
0
(1 row)
kingbase=# select count(*) from t1 where a = 200;
count
-------
0
(1 row)
kingbase=# commit ;
COMMIT
kingbase=# drop table t1;
DROP TABLE
kingbase=#
```
```sql
kingbase=# create table t1 (a int);
CREATE TABLE
kingbase=# insert into t1 select generate_series(1,20);
INSERT 0 20
kingbase=# drop table t1_id ;
DROP TABLE
kingbase=# create table t1_id (a int, id serial);
CREATE TABLE
kingbase=# insert into t1_id select a from t1;
INSERT 0 20
kingbase=# begin transaction ;
BEGIN
kingbase=# select count(*) from t1 where a < 100;
count
-------
20
(1 row)
kingbase=# select count(*) from t1 where a > 200;
count
-------
0
(1 row)
kingbase=# commit ;
COMMIT
kingbase=# begin transaction ;
BEGIN
kingbase=# select count(*) from t1 where a < 100;
count
-------
20
(1 row)
kingbase=# select count(*) from t1 where a > 200;
count
-------
0
(1 row)
kingbase=# select count(*) from t1 where a = 200;
count
-------
0
(1 row)
kingbase=# commit ;
COMMIT
kingbase=# begin transaction ;
BEGIN
kingbase=# select count(*) from t1 where a < 100;
count
-------
20
(1 row)
kingbase=# select count(*) from t1 where a < 200;
count
-------
20
(1 row)
kingbase=# select count(*) from t1 where a > 200;
count
-------
0
(1 row)
kingbase=# select count(*) from t1 where a = 200;
count
-------
0
(1 row)
kingbase=# commit ;
COMMIT
-- 将外部表sys_fdw_log做参数化处理,转成内部表 同时计算提取阶段的统计信息变化
kingbase=# select workload_capture_stop();
workload_capture_stop
-----------------------
t
(1 row)
kingbase=#
```
```sql
[kingbase@local64 sys_log]$ ll
total 24
-rw------- 1 kingbase kingbase 770 May 25 15:12 kingbase-2023-05-25_151139.log
-rw------- 1 kingbase kingbase 213 May 25 15:20 kingbase-2023-05-25_152043.log
-rw------- 1 kingbase kingbase 11752 May 25 15:20 sys_workload_2023-05-25_151207.csv
-rw------- 1 kingbase kingbase 482 May 25 15:20 sys_workload_2023-05-25_151207.log
[kingbase@local64 sys_log]$
```
***
产生报告如下:
```sql
-- 用于分析和输出特征提取报告
kingbase=# select workload_analyze_report();
workload_analyze_report
-----------------------------------------------------------------------------------------------------------------------------------------------
--会话特征汇总信息 +
会话类型ID 会话数量 会话数量占比 会话耗时 事务类型数量 事务总数量 +
c283a7ba02086b3ee76cd783b1528b6c 1 100.00% 0.08s 13 23 +
+
+
--会话类型 c283a7ba02086b3ee76cd783b1528b6c 汇总信息 +
--事务级特征信息 +
事务类型ID 执行次数 执行耗时 语句序列 +
08dd006b668c9c32883ffb5662c63966 1 0.01s select pg_catalog.quote_ident(c.relname) from +
pg_catalog.pg_class c where c.relkind in (?, ?) +
and +
substring(pg_catalog.quote_ident(c.relname),?,?)=? +
and pg_catalog.pg_table_is_visible(c.oid) and +
c.relnamespace <> (select oid from +
pg_catalog.pg_namespace where nspname = ?) union +
select pg_catalog.quote_ident(n.nspname) || ? from +
pg_catalog.pg_namespace n where +
substring(pg_catalog.quote_ident(n.nspname) || +
?,?,?)=? and (select pg_catalog.count(*) from +
pg_catalog.pg_namespace where +
substring(pg_catalog.quote_ident(nspname) || +
?,?,?) = +
substring(?,?,pg_catalog.length(pg_catalog.quote_ident(nspname))+?)) +
> ? union select pg_catalog.quote_ident(n.nspname) +
|| ? || pg_catalog.quote_ident(c.relname) from +
pg_catalog.pg_class c, pg_catalog.pg_namespace n +
where c.relnamespace = n.oid and c.relkind in (?, +
?) and substring(pg_catalog.quote_ident(n.nspname) +
|| ? || pg_catalog.quote_ident(c.relname),?,?)=? +
and substring(pg_catalog.quote_ident(n.nspname) || +
?,?,?) = +
substring(?,?,pg_catalog.length(pg_catalog.quote_ident(n.nspname))+?)+
and (select pg_catalog.count(*) from +
pg_catalog.pg_namespace where +
substring(pg_catalog.quote_ident(nspname) || +
?,?,?) = +
substring(?,?,pg_catalog.length(pg_catalog.quote_ident(nspname))+?)) +
= ? limit ? +
10d647703e925eb2c686765eff93cf62 3 0.01s select count(*) from t1 where a < ?; +
select count(*) from t1 where a < ?; +
select count(*) from t1 where a > ?; +
select count(*) from t1 where a = ?; +
25209462cd7b56db9fc67dc3b430d12e 2 0.00s set ora_input_emptystr_isnull to off; +
25e38b6dfa648fe48fb9402e909431ff 2 0.00s show ora_input_emptystr_isnull; +
2a4634fa621521f1de87c6947442c0f3 2 0.00s select count(*) from t1 where a < ?; +
select count(*) from t1 where a > ?; +
322eb747eef3050a9d9008cae35ba334 1 0.00s drop table t1_id ; +
5d536e4ac207a6602266216fe84eaa7d 1 0.01s select pg_catalog.quote_ident(c.relname) from +
pg_catalog.pg_class c where c.relkind in (?, ?, ?, +
?) and +
substring(pg_catalog.quote_ident(c.relname),?,?)=? +
and pg_catalog.pg_table_is_visible(c.oid) and +
c.relnamespace <> (select oid from +
pg_catalog.pg_namespace where nspname = ?) union +
select pg_catalog.quote_ident(n.nspname) || ? from +
pg_catalog.pg_namespace n where +
substring(pg_catalog.quote_ident(n.nspname) || +
?,?,?)=? and (select pg_catalog.count(*) from +
pg_catalog.pg_namespace where +
substring(pg_catalog.quote_ident(nspname) || +
?,?,?) = +
substring(?,?,pg_catalog.length(pg_catalog.quote_ident(nspname))+?)) +
> ? union select pg_catalog.quote_ident(n.nspname) +
|| ? || pg_catalog.quote_ident(c.relname) from +
pg_catalog.pg_class c, pg_catalog.pg_namespace n +
where c.relnamespace = n.oid and c.relkind in (?, +
?, ?, ?) and +
substring(pg_catalog.quote_ident(n.nspname) || ? +
|| pg_catalog.quote_ident(c.relname),?,?)=? and +
substring(pg_catalog.quote_ident(n.nspname) || +
?,?,?) = +
substring(?,?,pg_catalog.length(pg_catalog.quote_ident(n.nspname))+?)+
and (select pg_catalog.count(*) from +
pg_catalog.pg_namespace where +
substring(pg_catalog.quote_ident(nspname) || +
?,?,?) = +
substring(?,?,pg_catalog.length(pg_catalog.quote_ident(nspname))+?)) +
= ? limit ? +
6f56dcaa97d9273a5b97223a3369b3bb 1 0.01s drop table t1; +
7efeabe4ec6135d98a7c9c6931ee561f 2 0.01s create table t1 (a int); +
881f3e44e0749d0e187443116b57bbd9 2 0.00s set ora_input_emptystr_isnull to on; +
b43f6832b4192b453e4350e8b6ce9007 2 0.02s create table t1_id (a int, id serial); +
c5a97cd8e201eb18648d3a9a9d6abd06 2 0.01s insert into t1_id select a from t1; +
d0e55c30baff72cc8a9ec039efd2a928 2 0.01s insert into t1 select generate_series(?,?); +
+
--语句级特征信息 +
语句类型ID 执行次数 执行耗时 语句内容 +
0bf904ef1a40fb9fce93d3d0b659cecb 2 0.00s set ora_input_emptystr_isnull to on; +
18f850858e9f14a03ca4bf5137e6a375 1 0.01s select pg_catalog.quote_ident(c.relname) from +
pg_catalog.pg_class c where c.relkind in (?, ?, ?, +
?) and +
substring(pg_catalog.quote_ident(c.relname),?,?)=? +
and pg_catalog.pg_table_is_visible(c.oid) and +
c.relnamespace <> (select oid from +
pg_catalog.pg_namespace where nspname = ?) union +
select pg_catalog.quote_ident(n.nspname) || ? from +
pg_catalog.pg_namespace n where +
substring(pg_catalog.quote_ident(n.nspname) || +
?,?,?)=? and (select pg_catalog.count(*) from +
pg_catalog.pg_namespace where +
substring(pg_catalog.quote_ident(nspname) || +
?,?,?) = +
substring(?,?,pg_catalog.length(pg_catalog.quote_ident(nspname))+?)) +
> ? union select pg_catalog.quote_ident(n.nspname) +
|| ? || pg_catalog.quote_ident(c.relname) from +
pg_catalog.pg_class c, pg_catalog.pg_namespace n +
where c.relnamespace = n.oid and c.relkind in (?, +
?, ?, ?) and +
substring(pg_catalog.quote_ident(n.nspname) || ? +
|| pg_catalog.quote_ident(c.relname),?,?)=? and +
substring(pg_catalog.quote_ident(n.nspname) || +
?,?,?) = +
substring(?,?,pg_catalog.length(pg_catalog.quote_ident(n.nspname))+?)+
and (select pg_catalog.count(*) from +
pg_catalog.pg_namespace where +
substring(pg_catalog.quote_ident(nspname) || +
?,?,?) = +
substring(?,?,pg_catalog.length(pg_catalog.quote_ident(nspname))+?)) +
= ? limit ? +
419e9d87baa6ab9e8af3da398eb00375 7 0.01s select count(*) from t1 where a < ?; +
68af9a303ff2c9dd60f9da4d62c51506 2 0.00s show ora_input_emptystr_isnull; +
6adfb01aa93dfda1722bfda93c420ad7 2 0.01s insert into t1_id select a from t1; +
751a158e2cc536f226993f773c4475f2 2 0.00s set ora_input_emptystr_isnull to off; +
854feb932fa51ff37205003aae557e2f 2 0.01s create table t1 (a int); +
945f885acde06a2d8b776bf322bbc45c 3 0.00s select count(*) from t1 where a = ?; +
96d724808bd04fd90cbc2468ffb6dbe4 1 0.00s drop table t1_id ; +
bc821930a594db44f78caca7a25385be 1 0.01s select pg_catalog.quote_ident(c.relname) from +
pg_catalog.pg_class c where c.relkind in (?, ?) +
and +
substring(pg_catalog.quote_ident(c.relname),?,?)=? +
and pg_catalog.pg_table_is_visible(c.oid) and +
c.relnamespace <> (select oid from +
pg_catalog.pg_namespace where nspname = ?) union +
select pg_catalog.quote_ident(n.nspname) || ? from +
pg_catalog.pg_namespace n where +
substring(pg_catalog.quote_ident(n.nspname) || +
?,?,?)=? and (select pg_catalog.count(*) from +
pg_catalog.pg_namespace where +
substring(pg_catalog.quote_ident(nspname) || +
?,?,?) = +
substring(?,?,pg_catalog.length(pg_catalog.quote_ident(nspname))+?)) +
> ? union select pg_catalog.quote_ident(n.nspname) +
|| ? || pg_catalog.quote_ident(c.relname) from +
pg_catalog.pg_class c, pg_catalog.pg_namespace n +
where c.relnamespace = n.oid and c.relkind in (?, +
?) and substring(pg_catalog.quote_ident(n.nspname) +
|| ? || pg_catalog.quote_ident(c.relname),?,?)=? +
and substring(pg_catalog.quote_ident(n.nspname) || +
?,?,?) = +
substring(?,?,pg_catalog.length(pg_catalog.quote_ident(n.nspname))+?)+
and (select pg_catalog.count(*) from +
pg_catalog.pg_namespace where +
substring(pg_catalog.quote_ident(nspname) || +
?,?,?) = +
substring(?,?,pg_catalog.length(pg_catalog.quote_ident(nspname))+?)) +
= ? limit ? +
ce40a3ed8a5d00256943c419df7b9c54 2 0.02s create table t1_id (a int, id serial); +
f61f2c830e7a54dc6bcf0ac2a2035fab 2 0.01s insert into t1 select generate_series(?,?); +
f788038468755b81aa3f6feb473d76bd 1 0.01s drop table t1; +
f8377cd2c44656b6ce0dc0c513580204 5 0.00s select count(*) from t1 where a > ?; +
+
+
--表级特征信息 +
表名 容量 属性个数 页面数 元组数 +
t1 8192 bytes 1 0 0 +
t1_id 8192 bytes 2 0 0
(1 row)
kingbase=#
```
***
为用户自定义特征提取所用的数据表,如下:
```sql
kingbase=# \d sys_workload.*
Foreign table "sys_workload.sys_fdw_log"
Column | Type | Collation | Nullable | Default | FDW options
------------------------+-----------------------------+-----------+----------+---------+-------------
log_time | timestamp(3) with time zone | | | |
user_name | text | | | |
database_name | text | | | |
process_id | integer | | | |
connection_from | text | | | |
session_id | text | | | |
session_line_num | bigint | | | |
command_tag | text | | | |
session_start_time | timestamp with time zone | | | |
virtual_transcation_id | text | | | |
transcation_id | bigint | | | |
error_severity | text | | | |
sql_state_code | text | | | |
message | text | | | |
detail | text | | | |
hint | text | | | |
internal_query | text | | | |
internal_query_pos | integer | | | |
context | text | | | |
query | text | | | |
query_pos | integer | | | |
location | text | | | |
application_name | text | | | |
Server: sys_fdw_log
FDW options: (program E'find /home/kingbase/release/KESRealPro/V008R006C007B0024/Server/bin/test/sys_log/ -type f -name "sys_workload_2023-05-25_151207.csv" -exec cat {} \\;', format 'csv')
Unlogged table "sys_workload.sys_workload_log"
Column | Type | Collation | Nullable | Default
--------------------+---------+-----------+----------+---------
session_typeid | text | | |
transaction_typeid | text | | |
statement_typeid | text | | |
session_id | text | | |
session_line_num | bigint | | |
vtransaction_id | text | | |
query | text | | |
duration | numeric | | |
err_status | text | | |
Table "sys_workload.sys_workload_statistics"
Column | Type | Collation | Nullable | Default
------------+--------+-----------+----------+---------
relid | oid | | |
schemaname | name | | |
relname | name | | |
seq_scan | bigint | | |
idx_scan | bigint | | |
n_tup_ins | bigint | | |
n_tup_upd | bigint | | |
n_tup_del | bigint | | |
Table "sys_workload.sys_workload_statistics_snapshot"
Column | Type | Collation | Nullable | Default
---------------------+--------------------------+-----------+----------+---------
relid | oid | | |
schemaname | name | | |
relname | name | | |
seq_scan | bigint | | |
seq_tup_read | bigint | | |
idx_scan | bigint | | |
idx_tup_fetch | bigint | | |
n_tup_ins | bigint | | |
n_tup_upd | bigint | | |
n_tup_del | bigint | | |
n_tup_hot_upd | bigint | | |
n_live_tup | bigint | | |
n_dead_tup | bigint | | |
n_mod_since_analyze | bigint | | |
last_vacuum | timestamp with time zone | | |
last_autovacuum | timestamp with time zone | | |
last_analyze | timestamp with time zone | | |
last_autoanalyze | timestamp with time zone | | |
vacuum_count | bigint | | |
autovacuum_count | bigint | | |
analyze_count | bigint | | |
autoanalyze_count | bigint | | |
kingbase=#
```
```sql
kingbase=# table sys_workload.sys_workload_statistics;
relid | schemaname | relname | seq_scan | idx_scan | n_tup_ins | n_tup_upd | n_tup_del
-------+------------+---------+----------+----------+-----------+-----------+-----------
16423 | public | t1_id | 0 | | 20 | 0 | 0
16418 | public | t1 | 10 | | 20 | 0 | 0
(2 rows)
kingbase=# table sys_workload.sys_workload_statistics_snapshot ;
relid | schemaname | relname | seq_scan | seq_tup_read | idx_scan | idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze | last_vac
uum | last_autovacuum | last_analyze | last_autoanalyze | vacuum_count | autovacuum_count | analyze_count | autoanalyze_count
-------+------------+---------------------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------+---------------------+---------
----+-----------------+--------------+------------------+--------------+------------------+---------------+-------------------
13719 | sysmac | sysmac_policy | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| | | | 0 | 0 | 0 | 0
13741 | sysmac | sysmac_user | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| | | | 0 | 0 | 0 | 0
13730 | sysmac | sysmac_compartment | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| | | | 0 | 0 | 0 | 0
13726 | sysmac | sysmac_level | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| | | | 0 | 0 | 0 | 0
13734 | sysmac | sysmac_label | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| | | | 0 | 0 | 0 | 0
13738 | sysmac | sysmac_policy_enforcement | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| | | | 0 | 0 | 0 | 0
13842 | sys | dual | 0 | 0 | | | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| | | | 0 | 0 | 0 | 0
13744 | sysmac | sysmac_obj | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| | | | 0 | 0 | 0 | 0
(8 rows)
kingbase=#
```
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




