[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 最近更新 | 编码查看转换 | 代码下载 | 常见问题及讨论 | 《深入解析ASP核心技术》 | 王小鸭自动发工资条VBA版
登录系统:用户名: 密码: 如果要讨论问题,请先注册。

[备忘]postgresql查询长时间的事务

上一篇:[备忘]postgresql查询表的索引
下一篇:[备忘]idea的tomcat,控制台乱码

添加日期:2021/8/5 18:10:40 快速返回   返回列表 阅读593次
apple=#select pid, backend_start, xact_start, query_start, waiting, state, backend_xidfrom pg_stat_activitywhere backend_xidis notnull and now() - xact_start > interval'1 min';

-[ RECORD 1 ]-+------------------------------
pid           | 14604
backend_start | 2018-12-04 15:06:19.306234+08 -- 连接创建时间
xact_start    | 2018-12-04 16:08:25.528639+08 -- 事务begin时间
query_start   | 2018-12-04 16:09:03.921005+08 -- 事务中最近的查询开始时间,一个事务内有多个查询时,只记录最近的一个
waiting       | f                  -- 是否在等待,有锁时这里为t
state         | idlein transaction           -- 是否空闲,且仍然未提交
backend_xid   | 718176                        -- 当前事务的id,即xid。如果连接创建了,没有做任何操作,或者仅仅begin了,那么这里是空的;但是如果begin了,前面的xact_start就会记录事务开始时间。 另外,仅查询不会产生。
 

评论 COMMENTS
没有评论 No Comments.

添加评论 Add new comment.
昵称 Name:
评论内容 Comment:
验证码(不区分大小写)
Validation Code:
(not case sensitive)
看不清?点这里换一张!(Change it here!)
 
评论由管理员查看后才能显示。the comment will be showed after it is checked by admin.
CopyRight © 心缘地方 2005-2999. All Rights Reserved