元命令 \timing \watch
\timing 显示执行时间‘
psql客户端提示符
mydb=# \echo :PROMPT1 %/%R%#
%/ 当前数据库名称
%R 显示 =
%# 超级用户显示 > 普通用户显示 #
%M 数据库服务器别名
%> 数据库端口号
%/@%M:%>%R%#
将PROMPT1 的设置写进 .psqlrc文件,连接数据库库时自动读 .psqlrc文件
[postgres@s101 /var/lib/pgsql]$nano ~/.psqlrc
添加
\set PROMPT1 '%/@%M:%>%R%#'
设置前 [postgres@s101 /home/centos]$psql -U postgres -d postgres -p 5432 could not change directory to "/home/centos" psql (9.2.24, server 13.3) WARNING: psql version 9.2, server version 13.0. Some psql features might not work. Type "help" for help. postgres=# 设置后 [postgres@s101 /home/centos]$psql -h 192.168.17.101 -U postgres -d postgres -p 5432 could not change directory to "/home/centos" psql (9.2.24, server 13.3) WARNING: psql version 9.2, server version 13.0. Some psql features might not work. Type "help" for help. postgres@192.168.17.101:5432=#