YMatrix 文档
快速上手
集群部署
SQL参考
- ABORT
- ALTER_DATABASE
- ALTER_EXTENSION
- ALTER_EXTERNAL_TABLE
- ALTER_FOREIGN_DATA_WRAPPER
- ALTER_FOREIGN_TABLE
- ALTER_FUNCTION
- ALTER_INDEX
- ALTER_RESOURCE_GROUP
- ALTER_RESOURCE_QUEUE
- ALTER_ROLE
- ALTER_RULE
- ALTER_SCHEMA
- ALTER_SEQUENCE
- ALTER_SERVER
- ALTER_TABLE
- ALTER_TABLESPACE
- ALTER_TYPE
- ALTER_USER_MAPPING
- ALTER_VIEW
- ANALYZE
- BEGIN
- CHECKPOINT
- COMMIT
- COPY
- CREATE_DATABASE
- CREATE_EXTENSION
- CREATE_EXTERNAL_TABLE
- CREATE_FOREIGN_DATA_WRAPPER
- CREATE_FOREIGN_TABLE
- CREATE_FUNCTION
- CREATE_INDEX
- CREATE_RESOURCE_GROUP
- CREATE_RESOURCE_QUEUE
- CREATE_ROLE
- CREATE_RULE
- CREATE_SCHEMA
- CREATE_SEQUENCE
- CREATE_SERVER
- CREATE_TABLE
- CREATE_TABLE_AS
- CREATE_TABLESPACE
- CREATE_TYPE
- CREATE_USER_MAPPING
- CREATE_VIEW
- DELETE
- DROP_DATABASE
- DROP_EXTENSION
- DROP_EXTERNAL_TABLE
- DROP_FOREIGN_DATA_WRAPPER
- DROP_FOREIGN_TABLE
- DROP_FUNCTION
- DROP_INDEX
- DROP_RESOURCE_GROUP
- DROP_RESOURCE_QUEUE
- DROP_ROLE
- DROP_RULE
- DROP_SCHEMA
- DROP_SEQUENCE
- DROP_SERVER
- DROP_TABLE
- DROP_TABLESPACE
- DROP_TYPE
- DROP_USER_MAPPING
- DROP_VIEW
- END
- EXPLAIN
- GRANT
- INSERT
- LOAD
- LOCK
- REINDEX
- RELEASE_SAVEPOINT
- RESET
- REVOKE
- ROLLBACK_TO_SAVEPOINT
- ROLLBACK
- SAVEPOINT
- SELECT INTO
- SET ROLE
- SET TRANSACTION
- SET
- SHOW
- START TRANSACTION
- TRUNCATE
- UPDATE
- VACUUM
工具指南
现场保存工具 - minirepro
大家在使用MatrixDB的过程中可能会遇到如下问题:
- 慢查询
- 查询执行失败等
当遇到如上问题的时候,需要技术支持人员介入进行故障诊断,而技术人员做故障诊断则需要复原现场。minirepro
就是做现场保存的工具,用户只需要提供执行的SQL,就可以通过该工具生成现场环境,供技术人员在本地环境复现并追查。
minirepro使用方法
minirepro
会随着MatrixDB一起安装在$GPHOME/bin/minirepro
。可以通过如下命令查看使用方法:
[mxadmin@mdw ~]$ minirepro --help
Usage: minirepro <database> [options]
Options:
--version show program's version number and exit
-?, --help Show this help message and exit
-h HOST, --host=HOST Specify a remote host
-p PORT, --port=PORT Specify a port other than 5432
-U USER, --user=USER Connect as someone other than current user
-q QUERY_FILE file name that contains the query
-f OUTPUT_FILE minirepro output file name
-l, --hll Include HLL stats
WARNING: This tool collects statistics about your data, including most common
values, which requires some data elements to be included in the output file.
Please review output file to ensure it is within corporate policy to transport
the output file.
使用minirepro
做SQL执行现场保存首先要将SQL语句存放在文件中。如:要保存SQL语句SELECT * FROM data;
执行现场,将其保存在文件query.sql
中:
[mxadmin@mdw ~]$ cat query.sql
SELECT * FROM data;
然后执行命令,连接数据库并指定SQL文件和输出文件:
[mxadmin@mdw ~]$ minirepro mxadmin -h 127.0.0.1 -U mxadmin -p 5432 -q query.sql -f outfile.sql
Connecting to database: host=127.0.0.1, port=5432, user=mxadmin, db=mxadmin ...
Extracting metadata from query file query.sql ...
psql mxadmin --pset footer --no-psqlrc -Atq -h 127.0.0.1 -p 5432 -U mxadmin -f /tmp/20210729132431/toolkit.sql
Invoking pg_dump to dump DDL ...
pg_dump -h 127.0.0.1 -p 5432 -U mxadmin -sxO mxadmin --relation-oids 32820 --function-oids 0 -f /tmp/20210729132431/pg_dump_out.sql
Writing schema DDLs ...
Writing relation and function DDLs ...
Writing table statistics ...
Writing column statistics ...
Attaching raw query text ...
--- MiniRepro completed! ---
WARNING: This tool collects statistics about your data, including most common values, which requires some data elements to be included in the output file.
Please review output file to ensure it is within corporate policy to transport the output file.
这样,现场环境就保存到了outfile.sql
文件中,其内容包含了数据表和相关catalog信息。将该文件提供给技术人员即可。