返回首页

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

更新日期:2024年09月11日

获取帮助
使用SQLdiag 工具前,您可以通过以下指令获取帮助。
gs_dbmind component sqldiag --help
显示如下帮助信息:
usage:
[-h] [-f CSV_FILE] [--predicted-file PREDICTED_FILE]
[--model {template,dnn}] --model-path MODEL_PATH
[--config-file CONFIG_FILE]
{train,predict,finetune}
SQLdiag integrated by openGauss.
positional arguments:
{train,predict,finetune}
The training mode is to perform feature extraction and
model training based on historical SQL statements. The
prediction mode is to predict the execution time of a
new SQL statement through the trained model.
optional arguments:
-h, --help
show this help message and exit
-f CSV_FILE, --csv-file CSV_FILE
The data set for training or prediction. The file
format is CSV. If it is two columns, the format is
(SQL statement, duration time). If it is three

GBase 8c V5 开发者手册
南大通用数据技术股份有限公司
398
columns, the format is (timestamp of SQL statement
execution time, SQL statement, duration time).
--predicted-file PREDICTED_FILE
The file path to save the predicted result.
--model {template,dnn}
Choose the model model to use.
--model-path MODEL_PATH
The storage path of the model file, used to read or
save the model file.
--config-file CONFIG_FILE

|
+------+------+------+--------+-------------------------------------
800000 rows in set
导出SQL 语句:
gbase> SELECT * FROM test INTO OUTFILE '/home/gbase/temp/test.tbl'
fields terminated by ‘|’ with head;
Query OK, 800000 rows affected
查看导出文件:
$ cat test.tbl
ps_partkey| ps_suppkey| ps_availqty| ps_supplycost| ps_comment
1|2|3325|771.64|, even theodolites. Regular

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
1241
1|2502|8076|993.49|ven ideas. quickly
1|5002|3956|337.09|after the fluffily ironic
......
......

返回值
取模。返回N 除以M 后的余数。
示例
示例1
返回234 除以10 的余数。
gbase> SELECT MOD(234, 10) FROM t;
+--------------+
| MOD(234, 10) |
+--------------+
| 4 |
+--------------+
1 row in set
示例2
返回253 除以7 的余数。
gbase> SELECT 253 % 7 FROM t;
+---------+
| 253 % 7 |
+---------+
| 1 |
+---------+
1 row in set
示例3
gbase> SELECT MOD(29,9) FROM t;

GBase UP 产品手册 5 数据库管理指南
文档版本04(2021-04-21) 南大通用数据技术股份有限公司 464
+-----------+
| MOD(29,9) |
+-----------+
| 2 |
+-----------+
1 row in set

gbase> SELECT 29 MOD 9 FROM t;
+----------+
| 29 MOD 9 |
+----------+
| 2 |
+----------+
1 row in set
示例4
MOD()也适用于小数部分,返回除法运算后的精确余数。
gbase> SELECT MOD(34.5,3) FROM t;
+-------------+
| MOD(34.5,3) |
+-------------+
| 1.5 |
+-------------+
1 row in set
示例5
取模的三种表现形式。
gbase> SELECT 253 % 7, MOD(253,7), 253 MOD 7 FROM t;
+---------+------------+-----------+
| 253 % 7 | MOD(253,7) | 253 MOD 7 |
+---------+------------+-----------+
| 1 | 1 | 1 |
+---------+------------+-----------+
1 row in set