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

PostgreSQL About 1,471 words

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  --
Views: 3,787 · Posted: 2020-02-25

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

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

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


Today On History
Browsing Refresh