PostgrelSQL类似MySQL \G扩展显示结果

PostgreSQL大约 1470 字

MySQL \G

在命令行中,如果一行数据较多,会被换行显示,到时列名对不齐,看起来比较吃力,使用MySQL可以在SQL最后加上\G倒转显示。

select * from user \G

PostgreSQL \x

PostgreSQL中,也有类似的功能。使用\x开启扩展显示,再次输入即关闭。

z-blog=#  \x
扩展显示已打开
z-blog=# select * from pg_stat_activity;
-[ RECORD 1 ]----+---------------------------------------------------------------------------------------------------------------------------------------------------------------
datid            |
datname          |
pid              | 16936
usesysid         |
usename          |
application_name |
client_addr      |
client_hostname  |
client_port      |
backend_start    | 2020-02-16 21:14:56.11709+08
xact_start       |
query_start      |
state_change     |
wait_event_type  | Activity
wait_event       | AutoVacuumMain
state            |
backend_xid      |
backend_xmin     |
query            |
backend_type     | autovacuum launcher
-[ RECORD 2 ]----+---------------------------------------------------------------------------------------------------------------------------------------------------------------
datid            |
datname          |
pid              | 5144
usesysid         | 10
usename          | thunk
application_name |
client_addr      |
client_hostname  |
client_port      |
backend_start    | 2020-02-16 21:14:56.13742+08
xact_start       |
query_start      |
state_change     |
wait_event_type  | Activity
wait_event       | LogicalLauncherMain
state            |
backend_xid      |
backend_xmin     |
query            |
-- More  --
阅读 415 · 发布于 2020-02-25

————        END        ————

扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看换一批