GitHub - xuejiazhi/pgii: pgii is a PostgreSql cli tool. PostgreSql is developed in CMD or Golang and can be compiled for multiple platforms

pgii 是一个PostgreSql cli的工具,对PostgreSql 在CMD或者,采用Golang进行开发,可以多平台下面编译使用:

  • 跨平台: 可以在多平台下编译,跨平台使用;
  • 零学习成本:类似于MySQL Cli的指令,对熟悉mysql操作的人上手快;
  • 互动 Console: 通过命令行 console。
  • 增加了交互式提示: 可以提示要输入的命令 

登录

cmd:

  ./pgii [-h|--host] [-u|--user] [-p|--password] [-d|--db] [--port][-h|--host] postgresql 数据库地址  # eg: -h localhost | --host=localhost[-u|--user] 数据库用户名  # eg: -u postgres | --user=postgres[-p|--password]  数据库密码  # eg: -p postgres | --password=postgres[-d|--db] 选择的数据库 默认为postgres # eg: -d postgres | --db=postgres[--port] 指定的端口 # eg: --port=5432#### 示例$ pgii -h 127.0.0.1 -u postgres -p 123456 Connect Pgsql Success Host 127.0.0.1PostgresSql Version: 14.5pgii~[postgres/]#

设置语言

set language <cn|en>

功能:

使用些命令设置语言后,指令的头部显示可以是中文或英文

使用方式:

pgii~[postgres/]# show db;
+--------+-------------+----------+----------+------------+----------+-----------+-----------+------------+------------+---------+
| #OID   | DBNAME      | AUTH     | ENCODING | LC_COLLATE | LC_CTYPE | ALLOWCONN | CONNLIMIT | LASTSYSOID | TABLESPACE | SIZE    |
| 13891  | template0   | postgres | UTF8     | C          | C        | false     |        -1 | 13891      | pg_default | 8385 kB |
+--------+-------------+----------+----------+------------+----------+-----------+-----------+------------+------------+---------+
| 280382 | benchmark   | postgres | UTF8     | C          | C        | true      |        -1 | 13891      | pg_default | 10 MB   |
+--------+-------------+----------+----------+------------+----------+-----------+-----------+------------+------------+---------+
pgii~[postgres/]# set language cn;
Set Language Success
pgii~[postgres/]# show db;
+--------+-------------+--------------+----------+------------+----------+----------+----------------+-----------------+------------+------------+
| #OID   | 数据库      | 数据库拥用者 | 字符编码 | LC_COLLATE | LC_CTYPE | 允许连接 | 最大并发连接数 | 最后一个系统OID | 表空间     | 数据库尺寸 |
+--------+-------------+--------------+----------+------------+----------+----------+----------------+-----------------+------------+------------+
| 13892  | postgres[✓] | postgres     | UTF8     | C          | C        | true     |             -1 | 13891           | pg_default | 8537 kB    |
+--------+-------------+--------------+----------+------------+----------+----------+----------------+-----------------+------------+------------+
| 16384  | clouddb     | postgres     | UTF8     | C          | C        | true     |             -1 | 13891           | pg_default | 25 MB      |
+--------+-------------+--------------+----------+------------+----------+----------+----------------+-----------------+------------+------------+
| 1      | template1   | postgres     | UTF8     | C          | C        | true     |             -1 | 13891           | pg_default | 8385 kB    |
+--------+-------------+--------------+----------+------------+----------+----------+----------------+-----------------+------------+------------+
| 13891  | template0   | postgres     | UTF8     | C          | C        | false    |             -1 | 13891           | pg_default | 8385 kB    |
+--------+-------------+--------------+----------+------------+----------+----------+----------------+-----------------+------------+------------+
| 280382 | benchmark   | postgres     | UTF8     | C          | C        | true     |             -1 | 13891           | pg_default | 10 MB      |
+--------+-------------+--------------+----------+------------+----------+----------+----------------+-----------------+------------+------------+

相关指令

use 指令

use <db|database>

  功能:用于选择数据库,选中数据后,可以使用show db 或 show selectdb 查看当前选中的数据库用法:pgii~[postgres/]# use db benchmarkpgii~[postgres/]# use database benchmark# Use Database Success!pgii~[benchmark/]#

use <sc|schema>

  功能:用于选择数据库模式,选中模式后,可以使用show sc 或 show schema 查看当前选中的模式用法:pgii~[benchmark/]# use sc  public;pgii~[benchmark/]# use schema public;# Use Schema Success!pgii~[benchmark/public]#

show 指令

show <db|database>

  功能:用于查看数据库的相关信息,包括当前选中的库,以及库的大小用法pgii~[postgres/]# show database;pgii~[postgres/]# show db;
+-------+-------------+----------+----------+------------+----------+-----------+-----------+------------+------------+---------+
| #OID  | DBNAME      | AUTH     | ENCODING | LC_COLLATE | LC_CTYPE | ALLOWCONN | CONNLIMIT | LASTSYSOID | TABLESPACE | SIZE    |
+-------+-------------+----------+----------+------------+----------+-----------+-----------+------------+------------+---------+
| 13892 | postgres[✓] | postgres | UTF8     | C          | C        | true      |        -1 | 13891      | pg_default | 8537 kB |
| 16384 | clouddb     | postgres | UTF8     | C          | C        | true      |        -1 | 13891      | pg_default | 18 MB   |
| 1     | template1   | postgres | UTF8     | C          | C        | true      |        -1 | 13891      | pg_default | 8385 kB |
| 13891 | template0   | postgres | UTF8     | C          | C        | false     |        -1 | 13891      | pg_default | 8385 kB |
| 91966 | benchmark   | postgres | UTF8     | C          | C        | true      |        -1 | 13891      | pg_default | 3370 MB |
+-------+-------------+----------+----------+------------+----------+-----------+-----------+------------+------------+---------+

show <sc|schema>

  功能:用于查看数据库的相关模式信息,包括当前选中的模式用法pgii~[postgres/]# show schema;pgii~[postgres/]# show sc;
┌───────┬──────────────────────────┬──────────┬─────────────────────────────────────┐
│ #OID  │ SCHEMANAME               │ OWNER    │ ACL                                 │
├───────┼──────────────────────────┼──────────┼─────────────────────────────────────┤
│ 99    │ pg_toast                 │ postgres │ <nil>                               │
│ 11    │ pg_catalog               │ postgres │ {postgres=UC/postgres,=U/postgres}  │
│ 2200  │ public[✓]                │ postgres │ {postgres=UC/postgres,=UC/postgres} │
│ 13526 │ information_schema       │ postgres │ {postgres=UC/postgres,=U/postgres}  │
│ 91989 │ _timescaledb_cache       │ postgres │ {postgres=UC/postgres,=U/postgres}  │
│ 91987 │ _timescaledb_catalog     │ postgres │ {postgres=UC/postgres,=U/postgres}  │
│ 91988 │ _timescaledb_internal    │ postgres │ {postgres=UC/postgres,=U/postgres}  │
│ 91990 │ _timescaledb_config      │ postgres │ {postgres=UC/postgres,=U/postgres}  │
│ 91992 │ timescaledb_information  │ postgres │ {postgres=UC/postgres,=U/postgres}  │
│ 91991 │ timescaledb_experimental │ postgres │ {postgres=UC/postgres,=U/postgres}  │
└───────┴──────────────────────────┴──────────┴─────────────────────────────────────┘

show <tb|table> [filter|equal] [value]

  功能:用于查看数据库的相关表信息,使用filter,可以过滤TABLENAME包含value的记录,equal 为全等于用法pgii~[postgres/]# show table;pgii~[postgres/]# show tb;
+--------+-----------+------------+------------+-----------+-----------+
| SCHEMA | TABLENAME | TABLEOWNER | TABLESPACE | TABLESIZE | INDEXSIZE |
+--------+-----------+------------+------------+-----------+-----------+
| public | tags      | postgres   | <nil>      | 400 kB    | 264 kB    |
+--------+-----------+------------+------------+-----------+-----------+
| public | cpu       | postgres   | <nil>      | 32 kB     | 24 kB     |
+--------+-----------+------------+------------+-----------+-----------+
pgii~[benchmark/public]# show tb filter c
+--------+-----------+------------+------------+-----------+-----------+
| SCHEMA | TABLENAME | TABLEOWNER | TABLESPACE | TABLESIZE | INDEXSIZE |
+--------+-----------+------------+------------+-----------+-----------+
| public | cpu       | postgres   | <nil>      | <nil>     | <nil>     |
+--------+-----------+------------+------------+-----------+-----------+

show <vw|view> [filter|equal] [value]

  功能:用于查看数据库的相关视图信息,使用filter,可以过滤VIEWNAME包含value的记录,equal 为全等于用法pgii~[postgres/]# show view;pgii~[postgres/]# show vw;
+--------+----------+-----------+
| SCHEMA | VIEWNAME | VIEWOWNER |
+--------+----------+-----------+
| public | cpu_view | postgres  |
+--------+----------+-----------+
pgii~[benchmark/public]# show tb filter c
+--------+----------+-----------+
| SCHEMA | VIEWNAME | VIEWOWNER |
+--------+----------+-----------+
| public | cpu_view | postgres  |
+--------+----------+-----------+

show <tg|trigger> [filter|equal] [value]

  功能:用于查看数据库的相关触发器信息,使用filter,可以过滤触发器包含value的记录,equal 为全等于用法pgii~[postgres/]# show tg;pgii~[postgres/]# show trigger;
+-----------+--------+-------------------+--------------------+--------------------+--------------------+---------------+
| DATABASE  | SCHEMA | TRIGGER_NAME      | EVENT_MANIPULATION | EVENT_OBJECT_TABLE | ACTION_ORIENTATION | ACTION_TIMING |
+-----------+--------+-------------------+--------------------+--------------------+--------------------+---------------+
| benchmark | public | ts_insert_blocker | INSERT             | cpu                | ROW                | BEFORE        |
+-----------+--------+-------------------+--------------------+--------------------+--------------------+---------------+
pgii~[benchmark/public]# show trigger filter ts;
+-----------+--------+-------------------+--------------------+--------------------+--------------------+---------------+
| DATABASE  | SCHEMA | TRIGGER_NAME      | EVENT_MANIPULATION | EVENT_OBJECT_TABLE | ACTION_ORIENTATION | ACTION_TIMING |
+-----------+--------+-------------------+--------------------+--------------------+--------------------+---------------+
| benchmark | public | ts_insert_blocker | INSERT             | cpu                | ROW                | BEFORE        |
+-----------+--------+-------------------+--------------------+--------------------+--------------------+---------------+

show <ver|version>

  功能:用于查看数据库的相关版本信息用法pgii~[postgres/]# show version;pgii~[postgres/]# show ver;
+-------------+---------+
| #           | VERSION |
+-------------+---------+
| PostgresSql | 14.5    |
+-------------+---------+

show <sd|selectdb>

  功能:用于查看数据库的当前选中的database 和schema用法pgii~[benchmark/public]# show sd;pgii~[benchmark/public]# show selectdb;DataBase: benchmark ;Schema: public

show <connection|conn>

功能:

用于查看链接的一些参数 MAX_CONNECTION 最大连接数 SUPERUSER_RESERVED_CONNECTIONS 超级用户保留的连接数 REMAINING_CONNECTIONS 剩余连接数 INUSE_CONNECTIONS 当前正使用的连接数

方法:

pgii~[benchmark/public]# show connection;
+----------------+--------------------------------+-----------------------+-------------------+
| MAX_CONNECTION | SUPERUSER_RESERVED_CONNECTIONS | REMAINING_CONNECTIONS | INUSE_CONNECTIONS |
+----------------+--------------------------------+-----------------------+-------------------+
|            800 |                             13 |                   760 |                40 |
+----------------+--------------------------------+-----------------------+-------------------+

show <process|proc> [all]|[pid start and end]

功能:

用于查看当前数据库中的会话: all: 如果没有带 all 参数,那么只显示当前选择数据库下面的会话,带了all显示所有的会话; pid: 列出pid 在 start 和 end 区间内的会话

方法:

pgii~[postgres/]# show process;
+--------+---------------+-----------+---------------+-------------+--------------------------------------+--------+
| PID    | DATABASE_NAME | USER_NAME | CLIENT_ADDR   | CLIENT_PORT | APPLICATION_NAME                     | STATE  |
+--------+---------------+-----------+---------------+-------------+--------------------------------------+--------+
| 142668 | postgres      | postgres  | 10.161.55.214 | 56766       | DBeaver 22.0.2 - Main <postgres>     | idle   |
+--------+---------------+-----------+---------------+-------------+--------------------------------------+--------+
| 142669 | postgres      | postgres  | 10.161.55.214 | 56767       | DBeaver 22.0.2 - Metadata <postgres> | idle   |
+--------+---------------+-----------+---------------+-------------+--------------------------------------+--------+
| 206841 | postgres      | postgres  | 10.161.55.214 | 42969       |                                      | active |
+--------+---------------+-----------+---------------+-------------+--------------------------------------+--------+
pgii~[postgres/]# show process all;
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
| PID    | DATABASE_NAME | USER_NAME | CLIENT_ADDR     | CLIENT_PORT | APPLICATION_NAME                           | STATE  |
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
| 88720  |               |           |                 |             |                                            |        |
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
| 117720 | clouddb       | postgres  | 100.123.237.153 | 38390       |                                            | idle   |
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
| 90141  | clouddb       | postgres  | 100.123.237.196 | 54220       |                                            | idle   |
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
| 142668 | postgres      | postgres  | 10.161.55.214   | 56766       | DBeaver 22.0.2 - Main <postgres>           | idle   |
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
| 142669 | postgres      | postgres  | 10.161.55.214   | 56767       | DBeaver 22.0.2 - Metadata <postgres>       | idle   |
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
| 142670 | clouddb       | postgres  | 10.161.55.214   | 56768       | DBeaver 22.0.2 - SQLEditor <Script-24.sql> | idle   |
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
| 142671 | clouddb       | postgres  | 10.161.55.214   | 56769       | DBeaver 22.0.2 - Main <clouddb>            | idle   |
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
| 142672 | clouddb       | postgres  | 10.161.55.214   | 56770       | DBeaver 22.0.2 - Metadata <clouddb>        | idle   |
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
| 206841 | postgres      | postgres  | 10.161.55.214   | 42969       |                                            | active |
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
| 33133  |               |           |                 |             |                                            |        |
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
| 33135  |               |           |                 |             |                                            |        |
+--------+---------------+-----------+-----------------+-------------+--------------------------------------------+--------+
pgii~[postgres/]# show process pid 1 and 88585;
+-------+---------------+-----------+-----------------+-------------+------------------+-------+
| PID   | DATABASE_NAME | USER_NAME | CLIENT_ADDR     | CLIENT_PORT | APPLICATION_NAME | STATE |
+-------+---------------+-----------+-----------------+-------------+------------------+-------+
| 88585 | clouddb       | postgres  | 100.123.237.162 | 54040       |                  | idle  |
+-------+---------------+-----------+-----------------+-------------+------------------+-------+
| 88583 | clouddb       | postgres  | 100.123.237.150 | 58828       |                  | idle  |
+-------+---------------+-----------+-----------------+-------------+------------------+-------+
| 88581 |               | postgres  |                 |             |                  |       |
+-------+---------------+-----------+-----------------+-------------+------------------+-------+
| 88579 | clouddb       | postgres  | 100.123.237.196 | 35001       |                  | idle  |
+-------+---------------+-----------+-----------------+-------------+------------------+-------+
| 88578 | clouddb       | postgres  | 100.123.237.148 | 48182       |                  | idle  |
+-------+---------------+-----------+-----------------+-------------+------------------+-------+
| 88577 | clouddb       | postgres  | 100.123.237.149 | 44360       |                  | idle  |
+-------+---------------+-----------+-----------------+-------------+------------------+-------+
| 88576 | clouddb       | postgres  | 100.123.237.154 | 43840       |                  | idle  |
+-------+---------------+-----------+-----------------+-------------+------------------+-------+
| 88575 | clouddb       | postgres  | 100.123.237.164 | 57554       |                  | idle  |
+-------+---------------+-----------+-----------------+-------------+------------------+-------+
| 33135 |               |           |                 |             |                  |       |
+-------+---------------+-----------+-----------------+-------------+------------------+-------+
| 33133 |               |           |                 |             |                  |       |
+-------+---------------+-----------+-----------------+-------------+------------------+-------+
| 33134 |               |           |                 |             |                  |       |
+-------+---------------+-----------+-----------------+-------------+------------------+-------+

desc 指令

desc

  功能:用于查看表结构用法pgii~[benchmark/public]# desc cpu;
+----+------------------+-------------+--------+--------+--------------+
| #  | COLUMN           | DATATYPE    | LENGTH | ISNULL | DEFAULTVALUE |
+----+------------------+-------------+--------+--------+--------------+
| 1  | time             | timestamptz | <nil>  | NO     | <nil>        |
| 2  | tags_id          | int4        | <nil>  | YES    | <nil>        |
| 3  | hostname         | text        | <nil>  | YES    | <nil>        |
| 4  | usage_user       | float8      | <nil>  | YES    | <nil>        |
| 5  | usage_system     | float8      | <nil>  | YES    | <nil>        |
| 6  | usage_idle       | float8      | <nil>  | YES    | <nil>        |
| 7  | usage_nice       | float8      | <nil>  | YES    | <nil>        |
| 8  | usage_iowait     | float8      | <nil>  | YES    | <nil>        |
| 9  | usage_irq        | float8      | <nil>  | YES    | <nil>        |
| 10 | usage_softirq    | float8      | <nil>  | YES    | <nil>        |
| 11 | usage_steal      | float8      | <nil>  | YES    | <nil>        |
| 12 | usage_guest      | float8      | <nil>  | YES    | <nil>        |
| 13 | usage_guest_nice | float8      | <nil>  | YES    | <nil>        |
| 14 | additional_tags  | jsonb       | <nil>  | YES    | <nil>        |
+----+------------------+-------------+--------+--------+--------------+

size 指令

size <db|database>

  功能:用于查看数据库的大小用法pgii~[benchmark/public]# size database benchmark;pgii~[benchmark/public]# size db benchmark;
┌───────────┬─────────┐
│ DATABASE  │ SIZE    │
├───────────┼─────────┤
│ benchmark │ 3370 MB │
└───────────┴─────────┘

size <tb|table>

功能:

用于查看数据库表的大小

方法:

  pgii~[benchmark/public]# size table cpu;pgii~[benchmark/public]# size tb cpu;
┌───────────┬───────┐
│ TABLENAME │ SIZE  │
├───────────┼───────┤
│ cpu       │ 32 kB │
└───────────┴───────┘

size <tbsp|tablespace>

功能:

用于查看表空间的大小

方法:

pgii~[benchmark/public]# size tablespace pg_default;
+-----------------+-----------------+
| TABLESPACE_NAME | TABLESPACE_SIZE |
+-----------------+-----------------+
| pg_default      | 60 MB           |
+-----------------+-----------------+

ddl 指令

ddl <tb|table>

  功能:用于查看表的ddl建表语句用法pgii~[benchmark/public]# ddl table cpu;pgii~[benchmark/public]# ddl tb cpu;
========= Create Table Success ============
-- DROP Table;
-- DROP Table cpu;
CREATE TABLE "public".cpu (time timestamptz NOT NULL,tags_id int4 NULL,hostname text NULL,usage_user float8 NULL,usage_system float8 NULL,usage_idle float8 NULL,usage_nice float8 NULL,usage_iowait float8 NULL,usage_irq float8 NULL,usage_softirq float8 NULL,usage_steal float8 NULL,usage_guest float8 NULL,usage_guest_nice float8 NULL,additional_tags jsonb NULL
);
CREATE INDEX cpu_usage_user_time_idx ON public.cpu USING btree (usage_user, "time" DESC);
CREATE INDEX cpu_time_idx ON public.cpu USING btree ("time" DESC);
CREATE INDEX cpu_hostname_time_idx ON public.cpu USING btree (hostname, "time" DESC);

ddl <sc|schema>

  功能:用于查看模式的ddl建表语句用法pgii~[benchmark/public]# ddl schema public;pgii~[benchmark/public]# ddl sc public;
========= Create Schema Success ============
-- DROP SCHEMA public;
CREATE SCHEMA "public" AUTHORIZATION postgres;

ddl <vw|view>

  功能:用于查看视图的ddl建表语句用法pgii~[benchmark/public]# ddl view cpu_view;pgii~[benchmark/public]# ddl vw cpu_view;
========= Create View Success ============CREATE OR REPLACE VIEW "public".cpu_viewAS SELECT cpu."time",cpu.tags_id,cpu.hostname,cpu.usage_user,cpu.usage_system,cpu.usage_idle,cpu.usage_nice,cpu.usage_iowait,cpu.usage_irq,cpu.usage_softirq,cpu.usage_steal,cpu.usage_guest,cpu.usage_guest_nice,cpu.additional_tagsFROM cpuWHERE ((cpu."time" > '2023-03-01 08:00:00+08'::timestamp with time zone) AND (cpu.tags_id > 10) AND (cpu.tags_id < 1000) AND (cpu.usage_user = ANY (ARRAY[(21)::double precision, (22)::double precision, (23)::double precision, (24)::double precision, (25)::double precision, (26)::double precision, (27)::double precision, (28)::double precision, (29)::double precision])));

kill 指令

kill pid

功能:

关闭数据库中的会话,关闭后可以使用“show proc”查看是否关闭

用法:

pgii~[postgres/]# kill pid 33134;
Kill Process Success,pid[33134]

dump 指令

dump <tb|table>

  功能:用于dump一个表的备份文件,可以用于后续的恢复;用法pgii~[clouddb/common]# dump tb role;Dump Table Success## linux下查看[root@localhost src]# ls *.pgidump_table_role_time.pgi

dump <sc|schema>

  功能:用于dump当前模式和下面的表的建模式语句和建表语句,并将表下面数据生成批量插入的T-SQL语句,生成一个pgi文件;用法pgii~[clouddb/db_mcs.com]# dump sc;Dump Schema Success [db_mcs.com]Dump Table Struct Success [dgna]->Dump Table Record Success [dgna]Dump Table Struct Success [dgna_member]->Dump Table Record Success [dgna_member]Dump Table Struct Success [syspatch_info]->Dump Table Record Success [syspatch_info]Dump Table Struct Success [syspatch_member]->Dump Table Record Success [syspatch_member]Dump Table Struct Success [predefineddgna_info]->Dump Table Record Success [predefineddgna_info]Dump Table Struct Success [simulselect_info]->Dump Table Record Success [simulselect_info]Dump Table Struct Success [simulselect_member]->Dump Table Record Success [simulselect_member]## linux下查看[root@localhost src]# ls *.pgidump_schema_db_mcs.com.pgi

dump <db|database>

功能:

用于dump当前选择的数据库下面,并生成创建库,模式,表的语句,并将表里的数据生成批量插入的数据,生成一个压缩的pgi文件;

方法:

pgii~[clouddb/]# dump db;
>Dump DataBase Begin
Dump DataBase Struct Success
----------------------------------------
>>Dump Schema Success[db_mcs1.com]
>>>Dump Table Struct Success [pub_vpn]>>>>Dump Table Record Success ["db_mcs1.com".pub_vpn]
>>>Dump Table Struct Success [userprofile]>>>>Dump Table Record Success ["db_mcs1.com".userprofile]
>>>Dump Table Struct Success [pub_groupprofile]>>>>Dump Table Record Success ["db_mcs1.com".pub_groupprofile]
>>>Dump Table Struct Success [mcs_groupprofile]>>>>Dump Table Record Success ["db_mcs1.com".mcs_groupprofile]
>>>Dump Table Struct Success [pub_groupmember]>>>>Dump Table Record Success ["db_mcs1.com".pub_groupmember]
>>>Dump Table Struct Success [mcs_blacklist]>>>>Dump Table Record Success ["db_mcs1.com".mcs_blacklist]
>>>Dump Table Struct Success [mcs_groupareaconfig]>>>>Dump Table Record Success ["db_mcs1.com".mcs_groupareaconfig]
>>>Dump Table Struct Success [mcs_groupgpsareaconfig]>>>>Dump Table Record Success ["db_mcs1.com".mcs_groupgpsareaconfig]
>>>Dump Table Struct Success [pub_ldsvpn]>>>>Dump Table Record Success ["db_mcs1.com".pub_ldsvpn]
>>>Dump Table Struct Success [pub_record_user]>>>>Dump Table Record Success ["db_mcs1.com".pub_record_user]
>>>Dump Table Struct Success [pub_record_group]>>>>Dump Table Record Success ["db_mcs1.com".pub_record_group]
>>>Dump Table Struct Success [pub_record_vpn]>>>>Dump Table Record Success ["db_mcs1.com".pub_record_vpn]
>>>Dump Table Struct Success [mcs_user_area_authorize]>>>>Dump Table Record Success ["db_mcs1.com".mcs_user_area_authorize]
>>>Dump Table Struct Success [pub_ldsgmk]>>>>Dump Table Record Success ["db_mcs1.com".pub_ldsgmk]
>>>Dump Table Struct Success [pub_grouppatch_gmk]>>>>Dump Table Record Success ["db_mcs1.com".pub_grouppatch_gmk]
>>>Dump Table Struct Success [kms_random]>>>>Dump Table Record Success ["db_mcs1.com".kms_random]
>>>Dump Table Struct Success [callrecord]>>>>Dump Table Record Success ["db_mcs1.com".callrecord]
>>>Dump Table Struct Success [datarecord]>>>>Dump Table Record Success ["db_mcs1.com".datarecord]
>>>Dump Table Struct Success [t_frs_fileinfo]>>>>Dump Table Record Success ["db_mcs1.com".t_frs_fileinfo]
>>>Dump Table Struct Success [ue_register_backup]>>>>Dump Table Record Success ["db_mcs1.com".ue_register_backup]
>>>Dump Table Struct Success [mcs_user_contact_list]>>>>Dump Table Record Success ["db_mcs1.com".mcs_user_contact_list]
>>>Dump Table Struct Success [fa_info]>>>>Dump Table Record Success ["db_mcs1.com".fa_info]
>>>Dump Table Struct Success [fa_users]>>>>Dump Table Record Success ["db_mcs1.com".fa_users]
>>>Dump Table Struct Success [fa_history]>>>>Dump Table Record Success ["db_mcs1.com".fa_history]
>>>Dump Table Struct Success [user_roles]>>>>Dump Table Record Success ["db_mcs1.com".user_roles]
>>>Dump Table Struct Success [group_roles]>>>>Dump Table Record Success ["db_mcs1.com".group_roles]
>>>Dump Table Struct Success [pcall_role_pri]>>>>Dump Table Record Success ["db_mcs1.com".pcall_role_pri]
>>>Dump Table Struct Success [gcall_role_pri]>>>>Dump Table Record Success ["db_mcs1.com".gcall_role_pri]
>>>Dump Table Struct Success [mcs_user_common_sms_list]>>>>Dump Table Record Success ["db_mcs1.com".mcs_user_common_sms_list]
>>>Dump Table Struct Success [tetra_gid]>>>>Dump Table Record Success ["db_mcs1.com".tetra_gid]
>>>Dump Table Struct Success [service_priority]>>>>Dump Table Record Success ["db_mcs1.com".service_priority]
----------------------------------------
>>Dump Schema Success[public]
tips:Dump Cmd Table fail,no table in Schema!
----------------------------------------
>>Dump Schema Success[common]
>>>Dump Table Struct Success [app_cfg]>>>>Dump Table Record Success ["common".app_cfg]
>>>Dump Table Struct Success [gw_info]>>>>Dump Table Record Success ["common".gw_info]
>>>Dump Table Struct Success [listening_info]>>>>Dump Table Record Success ["common".listening_info]
>>>Dump Table Struct Success [mcs_user_area]>>>>Dump Table Record Success ["common".mcs_user_area]
>>>Dump Table Struct Success [tenant_info]>>>>Dump Table Record Success ["common".tenant_info]
>>>Dump Table Struct Success [pstn_info]>>>>Dump Table Record Success ["common".pstn_info]
>>>Dump Table Struct Success [terminal_statistic]>>>>Dump Table Record Success ["common".terminal_statistic]
>>>Dump Table Struct Success [tetra_cfg]>>>>Dump Table Record Success ["common".tetra_cfg]
----------------------------------------
## linux下查看
[root@localhost src]# ls *.pgi
dump_Database_clouddb_1680227905.pgi

explain

功能:

用于分析T-SQL执行计划

方法:

pgii~[clouddb/db_mcs.com]# explain ANALYZE select * from userprofile;
+---------------------------------------------------------------------------------------------------------------+
| QUERY PLAN                                                                                                    |
+---------------------------------------------------------------------------------------------------------------+
| Seq Scan on userprofile  (cost=0.00..105.41 rows=2241 width=230) (actual time=0.024..0.705 rows=2241 loops=1) |
| Planning time: 0.131 ms                                                                                       |
| Execution time: 0.882 ms                                                                                      |
+---------------------------------------------------------------------------------------------------------------+
[Total: 3 Rows]  [RunTimes 3.50s]pgii~[clouddb/db_mcs.com]# explain  select * from userprofile;
+------------------------------------------------------------------+
| QUERY PLAN                                                       |
+------------------------------------------------------------------+
| Seq Scan on userprofile  (cost=0.00..105.41 rows=2241 width=230) |
+------------------------------------------------------------------+
[Total: 1 Rows]  [RunTimes 2.18s]

TODO

  • dump database ✅
  • kill pid ✅
  • show process ✅
  • load table
  • load schema
  • load database

一个PostgreSql cli的工具相关推荐

  1. 自己写的python软件可以在哪发布-如何发布一个Python命令行工具

    本文简介 上次写的一个终端里面斗鱼TV弹幕Python版本和Ruby版本,并且发布到PIP和RubyGems上面.在发布PIP包的时候,居然Google不到一篇可以非常好的讲解这个流程的文章.于是整理 ...

  2. 介绍一个C++的ORM工具ODB(一) | C瓜哥的博客

    介绍一个C++的ORM工具ODB(一) | C瓜哥的博客 介绍一个C++的ORM工具ODB(一) 前段时间了解了下ORM(对象关系映射),然后就找了下C++的ORM框架,发现真的是很少,主要就下面几种 ...

  3. opengl中的Floatbuffer和IntBuffer与java中数据的存储方式不同的解决方法,编辑一个自己的BufferUtil工具类

    opengl中的Floatbuffer和IntBuffer与java中数据的存储方式不同的解决方法,编辑一个自己的BufferUtil工具类 参考文章: (1)opengl中的Floatbuffer和 ...

  4. python实现火车票查询工具_Python 实现一个火车票查询的工具

    原标题:Python 实现一个火车票查询的工具 作者 sexycoder 本文转载自简书,转载需授权 使用 python 实现一个查询火车票的小工具 主要功能: 输入出发车站,到达车站,时间,然后返回 ...

  5. python测试开发自学教程-Web开发哪家强?看我用 Python 写一个颜值测试小工具

    我们知道现在有一些利用照片来测试颜值的网站或软件,其实使用 Python 就可以实现这一功能,本文我们使用 Python 来写一个颜值测试小工具. 简介 要实现颜值测试功能,大致有两种方式:一种是自己 ...

  6. 用python编写一个高效搜索代码工具

    用python编写一个高效搜索代码工具 大多码农在linux环境下使用grep+关键词的命令搜索自己想要的代码或者log文件.今天介绍用python如何编写一个更强大的搜索工具,windows下也适用 ...

  7. 搜索python代码的软件_用python编写一个高效搜索代码工具

    用python编写一个高效搜索代码工具 大多码农在linux环境下使用grep+关键词的命令搜索自己想要的代码或者log文件.今天介绍用python如何编写一个更强大的搜索工具,windows下也适用 ...

  8. python调用公共方法_common: 这是一个Python的公共工具类,集成了各种主要的python常用方法...

    common 介绍 这是一个Python的公共工具类,集成了各种主要的python常用方法. 本人是做java开发的,学习python很多情况下是把他当做一个脚本来使用,在使用的过程中,发现很多的功能 ...

  9. 手写一个简易bundler打包工具带你了解Webpack原理

    用原生js手写一个简易的打包工具bundler

最新文章

  1. nodeValue以及其与value的区别以及JS nodeName、nodeValue、nodeType返回类型
  2. 旋转矩阵和角速度的一些应用
  3. 堆排序(利用最大堆)
  4. 【SpringMVC】SpringMVC+Spring+hibernate整合
  5. 查看python安装位置图_python安装路径怎么找
  6. 关于VS2005安装项目制作的三个参考文章链接
  7. ASP.NET Report Starter Kit视频教程--1
  8. 总是找不到电脑文件?学会这 3 个 Mac 搜索技巧,一秒就能找到
  9. Spring源代码地址
  10. 前轮反馈控制(Stanley) 法
  11. atmega128 单片机 密码锁 PROTEUS 仿真
  12. 如何理解相关性系数(pearson、spearman、kendall)
  13. 电脑如何打开虚拟化设置?
  14. 什么是DFX测试.md
  15. 那些年我们用过的显示器接口
  16. Android 图片选取画图案
  17. Lumen 安装配置
  18. 浏览器利用Webcam+Flash启用摄像头,并完成拍照
  19. 解决Ubuntu18无法进入-显示/dev/nvme0n1p8:recovering Journal
  20. 11 贪吃蛇小游戏 js版本 + vue版本

热门文章

  1. 【OpenCV3.3+Python3.6】图片的BGR通道的分离、修改以及合并
  2. 手机Camera基础知识
  3. 工程制图第五章【广工】
  4. 力扣第八题 myatoi
  5. 在找传感器设计方案或者应用吗?这里这里,全都是!
  6. 洛谷 - 一些好玩的问题 2
  7. python 抽奖 配音乐_抖音上超好听的神曲音乐,Python教你一次性下载
  8. linux系统挂载emc存储,Linux平台识别EMC存储磁盘
  9. 计算机网络实验毕业论文,计算机网络实验五.doc
  10. 【英语天天读】Account of My Travels