返回首页

gbase数据、南大通用产品文档:GBase8c

更新日期:2024年09月11日

Average:
all

功能
这个参数用于设置评估两表join 结果的方式。
参数取值含义说明

参数= 0:按照两表行数相乘进行评估;

参数= 1:按照两表中的大表的行数进行评估。
该参数的默认值是1。
表6- 22 参数值范围说明表
默认值
最小值
最大值
1
0
1

示例
使用系统表查看审计日志。
$ gccli -uroot -p
Enter password:
GBase client 9.5.3.17.117651. Copyright (c) 2004-2020, GBase.
All Rights
Reserved.
gbase> SET long_query_time = 0;
Query OK, 0 rows affected
gbase> SET GLOBAL audit_log = 1;
Query OK, 0 rows affected
gbase>CREATE AUDIT POLICY audit_policy_1 ( Enable = 'Y' );
Query OK, 0 rows affected
gbase> SET GLOBAL log_output = 'table';
Query OK, 0 rows affected
gbase> CREATE USER u_sj identified by 'u_sj';
Query OK, 0 rows affected
gbase> GRANT ALL ON *.* TO u_sj;
Query OK, 0 rows affected

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
372
gbase> CREATE DATABASE testSJ;
Query OK, 1 row affected
gbase> USE testSJ;
Query OK, 0 rows affected
gbase> CREATE TABLE t1(i int);
Query OK, 0 rows affected
gbase> INSERT INTO t1 VALUES (1),(2);
Query OK, 2 rows affected
gbase> SELECT start_time,user_host,query_time,rows,LEFT(sql_text, 30),
conn_type FROM gbase.audit_log;
+---------------------+----------------------------------+
| start_time
| user_host
|
+---------------------+----------------------------------+
| 2021-06-16 10:40:24 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:24 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:24 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:24 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:24 | root[root] @ localhost []
|
| 2021-06-16 10:40:33 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:33 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:33 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:32 | root[root] @ localhost []
|
| 2021-06-16 10:40:44 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:44 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:44 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:44 | root[root] @ localhost []
|
| 2021-06-16 10:40:48 | gbase[gbase] @
[192.168.146.24] |
| 2021-06-16 10:40:49 | gbase[gbase] @
[192.168.146.24] |
| 2021-06-16 10:40:49 | gbase[gbase] @
[192.168.146.24] |
| 2021-06-16 10:40:57 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:57 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:57 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:57 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:40:57 | root[root] @ localhost []
|
| 2021-06-16 10:41:05 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:41:05 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:41:05 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:41:05 | root[root] @ localhost []
|
| 2021-06-16 10:41:17 | gbase[gbase] @
[192.168.146.24] |
| 2021-06-16 10:41:17 | gbase[gbase] @
[192.168.146.24] |
| 2021-06-16 10:41:17 | gbase[gbase] @
[192.168.146.24] |
| 2021-06-16 10:41:17 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:41:17 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:41:17 | root[root] @
[192.168.146.24]
|

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
373
| 2021-06-16 10:41:17 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:41:17 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:41:17 | root[root] @ localhost []
|
| 2021-06-16 10:41:29 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:41:29 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:41:29 | root[root] @
[192.168.146.24]
|
| 2021-06-16 10:41:29 | root[root] @ localhost []
|
| 2021-06-16 10:41:43 | root[root] @ localhost []
|
+---------------------+----------------------------------+
+-----------------+------+--------------------------------+-----------+
| query_time
| rows | LEFT(sql_text, 30)
| conn_type |
+-----------------+------+--------------------------------+-----------+
| 00:00:00.000012 |
0 | Ping
| CAPI
|
| 00:00:00.000115 |
0 | SET NAMES utf8mb4
| CAPI
|
| 00:00:00.000164 |
0 | SET SELF SCN = 0
| CAPI
|
| 00:00:00.000094 |
0 | SET
SELF GLOBAL log_output =
| CAPI
|
| 00:00:00.239863 |
0 | SET GLOBAL log_output = 'table | ODBC
|
| 00:00:00.000009 |
0 | Ping
| CAPI
|
| 00:00:00.000143 |
0 | SET SELF SCN = 0
| CAPI
|
| 00:00:01.149579 |
0 | CREATE GCLUSTER_LOCAL USER "u_ | CAPI
|
| 00:00:04.376179 |
0 | CREATE USER u_sj identified by | ODBC
|
| 00:00:00.000019 |
0 | Ping
| CAPI
|
| 00:00:00.000207 |
0 | SET SELF SCN = 0
| CAPI
|
| 00:00:00.057846 |
0 | GRANT /*+vcid*/ GCLUSTER_LOCAL | CAPI
|
| 00:00:00.266514 |
0 | GRANT ALL ON *.* TO u_sj
| ODBC
|
| 00:00:00.001372 |
0 | Connect
| CAPI
|
| 00:00:00.000005 |
0 | Ping
| CAPI
|
| 00:00:00.000002 |
0 | Quit
| CAPI
|
| 00:00:00.000008 |
0 | Ping
| CAPI
|
| 00:00:00.000090 |
0 | SET NAMES utf8
| CAPI
|
| 00:00:00.000147 |
0 | SET SELF SCN = 9259
| CAPI
|
| 00:00:00.261615 |
0 | CREATE GCLUSTER_LOCAL DATABASE | CAPI |
| 00:00:00.965256 |
0 | CREATE DATABASE testSJ
| ODBC
|
| 00:00:00.000018 |
0 | Ping
| CAPI
|
| 00:00:00.000042 |
0 | Init VC Name
| CAPI
|
| 00:00:00.000058 |
0 | Init DB
| CAPI
|
| 00:00:00.014822 |
0 | USE testSJ
| ODBC
|
| 00:00:00.004341 |
0 | Connect
| CAPI
|
| 00:00:00.032791 |
0 | select table_id from informati | CAPI
|
| 00:00:00.000003 |
0 | Quit
| CAPI
|
| 00:00:00.000038 |
0 | Ping
| CAPI
|
| 00:00:00.000046 |
0 | Init VC Name
| CAPI
|

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
374
| 00:00:00.000070 |
0 | Init DB
| CAPI
|
| 00:00:00.000547 |
0 | SET SELF SCN = 9260
| CAPI
|
| 00:00:00.781898 |
0 | CREATE
GCLUSTER_LOCAL
TABLE
| CAPI |
| 00:00:02.731924 |
0 | CREATE TABLE t1(i int)
| ODBC
|
| 00:00:00.000132 |
0 | commit
| CAPI
|
| 00:00:00.000614 |
0 | set autocommit=1
| CAPI
|
| 00:00:00.000175 |
0 | set autocommit=1
| CAPI
|
| 00:00:00.200714 |
2 | INSERT INTO t1 VALUES (1),(2)
| ODBC
|
| 00:00:00.000530 |
38 | SELECT start_time,user_host,qu | ODBC
|
+-----------------+------+--------------------------------+-----------+
39 rows in set (Elapsed: 00:00:00.00)
gbase> INSERT INTO t1 SELECT * FROM t1;
Query OK, 2 rows affected
gbase> UPDATE t1 SET i = 3;
Query OK, 4 rows affected
gbase> DELETE FROM t1;
Query OK, 4 rows affected
gbase> SELECT start_time,user_host,query_time,rows, LEFT(sql_text, 30),
conn_type FROM gbase.audit_log;
+---------------------+--------------------------------+
| start_time
| user_host
|
+---------------------+--------------------------------+
| 2021-06-16 11:17:18 | root[root] @ localhost []
|
| 2021-06-16 11:18:09 | root[root] @ localhost []
|
| 2021-06-16 11:18:21 | root[root] @
[192.168.146.24] |
| 2021-06-16 11:18:21 | root[root] @
[192.168.146.24] |
| 2021-06-16 11:18:21 | root[root] @
[192.168.146.24] |
| 2021-06-16 11:18:20 | root[root] @ localhost []
|
| 2021-06-16 11:18:29 | root[root] @
[192.168.146.24] |
| 2021-06-16 11:18:29 | root[root] @
[192.168.146.24] |
| 2021-06-16 11:18:29 | root[root] @
[192.168.146.24] |
| 2021-06-16 11:18:28 | root[root] @ localhost []
|
+---------------------+--------------------------------+
+-----------------+------+--------------------------------+-----------+
| query_time
| rows | LEFT(sql_text, 30)
| conn_type |
+-----------------+------+--------------------------------+-----------+
| 00:00:00.003119 |
0 | truncate self table gbase.audi | ODBC
|
| 00:00:02.090188 |
2 | INSERT INTO t1 SELECT * FROM t | ODBC
|
| 00:00:00.000095 |
0 | commit
| CAPI
|
| 00:00:00.000272 |
0 | set autocommit=1
| CAPI
|
| 00:00:00.000416 |
0 | set autocommit=1
| CAPI
|
| 00:00:01.108768 |
4 | UPDATE t1 SET i = 3
| ODBC
|

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
375
| 00:00:00.000057 |
0 | commit
| CAPI
|
| 00:00:00.000198 |
0 | set autocommit=1
| CAPI
|
| 00:00:00.000899 |
0 | set autocommit=1
| CAPI
|
| 00:00:00.396723 |
4 | DELETE FROM t1
| ODBC
|
+-----------------+------+--------------------------------+-----------+
10 rows in set (Elapsed: 00:00:00.00)