pg_stat_activity

pg_stat_activity是PostgreSQL数据库中的一个视图,用于显示每个服务器进程的当前活动信息,包括进程ID、启动时间、状态、查询等详细数据。通过查询这个视图,管理员可以了解数据库的运行状态,诊断性能问题。
摘要由CSDN通过智能技术生成

The pg_stat_activity view will have one row per server process, showing information related to the current activity of that process.

\d pg_stat_activity;
           View "pg_catalog.pg_stat_activity"
      Column      |           Type           | Modifiers 
------------------+--------------------------+-----------
 datid            | oid                      | 
 datname          | name                     | 
 pid              | bigint                   | 
 sessionid        | bigint                   | 
 usesysid         | oid                      | 
 usename          | name                     | 
 application_name | text                     | 
 client_addr      | inet                     | 
 client_hostname  | text                     | 
 client_port      | integer                  | 
 backend_start    | timestamp with time zone | 
 xact_start       | timestamp with time zone | 
 query_start      | timestamp with time zone | 
 state_change     | timestamp with time zone | 
 waiting          | boolean                  | 
 enqueue          | text                     | 
 state            | text                     | 
 resource_pool    | name                     | 
 query_id         | bigint                   | 
 query            | text                     | 
 connection_info  | text                     | 
 unique_sql_id    | bigint                   | 
 trace_id         | text                     | 
select * from pg_stat_activity;
select datname, backend_start, connection_info from pg_stat_activity;

pg9.6
pg14
理解 pg_stat_activity

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值