ACCESS SHARE
锁定,即,只有对表的读动作可以和持有这个锁模式的事务并发执行。在GP中排它锁由 delete,update引起。insert引起行独占每个锁模式的最重要的信息是与彼此冲突的模式列表。在同一时间同一个表中,2 个事务不能同时保持相冲突的锁模式。事务永远不会与自身发生冲突。 非冲突的锁可以支持多事务并发。同样重要的是要知道有的模式和自身冲突。一些锁模式在获得后会持续到事务结束。但如果锁是在建立一个保存点后获得,保存点回滚后锁会被立刻释放。 下面的表格展示了哪些模式是互相冲突的:
ACCESS EXCLUSIVE
锁,然后又会
在同一表上获得ACCESS SHARE
锁。ACCESS EXCLUSIVE
锁定),而另一些则不是自冲突的(例如,可以由以下方式持有ACCESS SHARE
锁定)即使在不同的子事务中,事务也可以在同一行上持有冲突的锁。但是除此之外,两个事务永远不能在同一行上持有冲突的锁。行级锁不影响数据查询。它们仅阻值在同一行数据做写操作。
提供相关视图,用于排查锁
Current overall state of this backend. Possible values are:
active: The backend is executing a query.
idle: The backend is waiting for a new client command.
idle in transaction: The backend is in a transaction, but is not currently executing a query.
idle in transaction (aborted): This state is similar to idle in transaction, except one of the statements in the transaction caused an error.
fastpath function call: The backend is executing a fast-path function.
disabled: This state is reported if track_activities is disabled in this backend.
pg_locks
pg_locks
显示独立系统的普通锁管理器和谓词锁管理器的数据.pg_locks
对每个活跃的可锁定对象、请求的锁模式、 以及相关的事务保存一行。因此,如果多个事务持有或者等待对同一个对象的锁, 那么同一个可锁定的对象可能出现多次。不过,一个目前没有锁在其上的对象将肯定不会出现。
# pid字段可以和pg_stat_activity 视图的pid字段连接起来获取持有或者等待持有每个锁的会话的更多信息
SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
ON pl.pid = psa.pid;
# 查找到锁住的语句
select * from pg_stat_activity where waiting_reason='lock';
--datid|datname|pid |sess_id|usesysid|usename |application_name|client_addr |client_hostname|client_port|backend_start |xact_start |query_start |state_change |waiting|state |backend_xid|backend_xmin|query |waiting_reason|rsgid|rsgname|rsgqueueduration|
-------|-------|----|-------|--------|--------|----------------|--------------|---------------|-----------|-------------------|-------------------|-------------------|-------------------|-------|------|-----------|------------|------------------------------------|--------------|-----|-------|----------------|
--16385|cabbeen|3124| 537802| 16384|cabbeenc|Navicat |218.107.11.199| | 53250|2020-03-25 14:29:07|2020-03-25 14:29:12|2020-03-25 14:29:30|2020-03-25 14:29:30|true |active| |1229747 |truncate table cabbeen_perm.iam_user|lock | 0|unknown| |
# 根据执行的语句中的表,找到被锁住的表所在程序的lorpid
select * from gp_toolkit.gp_locks_on_relation where lorrelname like '%iam_user%';
--lorlocktype|lordatabase|lorrelname|lorrelation|lortransaction|lorpid|lormode |lorgranted|lorcurrentquery |
-------------|-----------|----------|-----------|--------------|------|-------------------|----------|------------------------------------|
--relation | 16385|iam_user | 21325| | 3124|AccessExclusiveLock|false |truncate table cabbeen_perm.iam_user|
--relation | 16385|iam_user | 21325| | 19865|AccessExclusiveLock|true |lock table cabbeen_perm.iam_user |
此粒度更细。
master节点:
查看segment锁情况
select gp_execution_dbid(), pid, relation::regclass, locktype, mode, granted
from gp_dist_random('pg_locks');
查看具体什么语句持有的锁
select gp_execution_dbid() dbid,pid procpid,query current_query
from gp_dist_random('pg_stat_activity')
where pid in
(select pid from gp_dist_random('pg_locks') where locktype='relation' and mode='ExclusiveLock');
通过以上语句大概定位到持有锁的segment
segment节点:
根据实际情况进行处理
1.连接相关segment,xxxx替换为实际segment节点的ip,端口,库名
PGOPTIONS="-c gp_session_role=utility" psql -h xxxxxxxxx -p xxxx -d xxxxx
2.在segment查询相关锁情况
SELECT
w.query as waiting_query,
w.pid as w_pid,
w.usename as w_user,
l.query as locking_query,
l.pid as l_pid,
l.usename as l_user,
t.schemaname || '.' || t.relname as tablename
from pg_stat_activity w
join pg_locks l1 on w.pid = l1.pid and not l1.granted
join pg_locks l2 on l1.relation = l2.relation and l2.granted
join pg_stat_activity l on l2.pid = l.pid
join pg_stat_user_tables t on l1.relation = t.relid
where w.waiting;
3.处理持有锁的pid
select pg_terminate_backend('procpid');
---------------------
--GP查看锁
SELECT pid,rolname, rsqname, granted,
current_query, datname
FROM pg_roles, gp_toolkit.gp_resqueue_status, pg_locks, pg_stat_activity
WHERE pg_roles.rolresqueue=pg_locks.objid
AND pg_locks.objid=gp_toolkit.gp_resqueue_status.queueid
AND pg_stat_activity.procpid=pg_locks.pid;
--GP解除锁定
pg_cancel_backend(#pid)
可以根据优先级找到锁,并包含锁的详细信息。推荐使用
with
t_wait as
(
select a.mode,a.locktype,a.database,a.relation,a.page,a.tuple,a.classid,a.granted,
a.objid,a.objsubid,a.pid,a.transactionid,a.mppsessionid,a.mppiswriter,a.gp_segment_id,
b.pid procpid,b.sess_id,b.waiting_reason,b.query current_query,b.xact_start,b.query_start,b.usename,b.datname,b.client_addr,b.client_port,b.application_name
from pg_locks a,pg_stat_activity b where a.mppsessionid=b.sess_id and not a.granted
),
t_run as
(
select a.mode,a.locktype,a.database,a.relation,a.page,a.tuple,a.classid,a.granted,
a.objid,a.objsubid,a.pid,a.transactionid,a.mppsessionid,a.mppiswriter,a.gp_segment_id,
b.pid procpid,b.sess_id,b.waiting_reason,b.query current_query,b.xact_start,b.query_start,b.usename,b.datname,b.client_addr,b.client_port,b.application_name
from pg_locks a,pg_stat_activity b where a.mppsessionid=b.sess_id and a.granted
),
t_overlap as
(
select r.* from t_wait w join t_run r on
(
r.locktype is not distinct from w.locktype and
r.database is not distinct from w.database and
r.relation is not distinct from w.relation and
r.page is not distinct from w.page and
r.tuple is not distinct from w.tuple and
r.transactionid is not distinct from w.transactionid and
r.classid is not distinct from w.classid and
r.objid is not distinct from w.objid and
r.objsubid is not distinct from w.objsubid and
r.mppsessionid <> w.mppsessionid
)
),
t_unionall as
(
select r.* from t_overlap r
union all
select w.* from t_wait w
)
select locktype,datname,relation::regclass,page,tuple,textin(xidout(transactionid)),classid::regclass,objid,objsubid,
string_agg(
'Gp_Segment_Id: '||case when gp_segment_id is null then 'NULL' else gp_segment_id::text end||chr(10)||
'MppIsWriter: '||case when mppiswriter is null then 'NULL' when mppiswriter is true then 'TRUE' else 'FALSE' end||chr(10)||
'MppSessionId: '||case when mppsessionid is null then 'NULL' else mppsessionid::text end||chr(10)||
'ProcPid: '||case when procpid is null then 'NULL' else procpid::text end||chr(10)||
'Pid: '||case when pid is null then 'NULL' else pid::text end||chr(10)||
'Lock_Granted: '||case when granted is null then 'NULL' when granted is true then 'TRUE' else 'FALSE' end||' , Mode: '||case when mode is null then 'NULL' else mode::text end||' , Waiting_Reason: '||case when waiting_reason is null then 'NULL' else waiting_reason::text end||chr(10)||
'Username: '||case when usename is null then 'NULL' else usename::text end||' , Database: '||case when datname is null then 'NULL' else datname::text end||' , Client_Addr: '||case when client_addr is null then 'NULL' else client_addr::text end||' , Client_Port: '||case when client_port is null then 'NULL' else client_port::text end||' , Application_Name: '||case when application_name is null then 'NULL' else application_name::text end||chr(10)||
'Xact_Start: '||case when xact_start is null then 'NULL' else xact_start::text end||' , Query_Start: '||case when query_start is null then 'NULL' else query_start::text end||' , Xact_Elapse: '||case when (now()-xact_start) is null then 'NULL' else (now()-xact_start)::text end||' , Query_Elapse: '||case when (now()-query_start) is null then 'NULL' else (now()-query_start)::text end||chr(10)||
'SQL (Current SQL in Transaction): '||chr(10)||
case when current_query is null then 'NULL' else current_query::text end,
chr(10)||'--------'||chr(10)
order by
( case mode
when 'INVALID' then 0
when 'AccessShareLock' then 1
when 'RowShareLock' then 2
when 'RowExclusiveLock' then 3
when 'ShareUpdateExclusiveLock' then 4
when 'ShareLock' then 5
when 'ShareRowExclusiveLock' then 6
when 'ExclusiveLock' then 7
when 'AccessExclusiveLock' then 8
else 0
end ) desc,
(case when granted then 0 else 1 end)
) as lock_conflict
from t_unionall
group by
locktype,datname,relation::regclass,page,tuple,textin(xidout(transactionid)),classid::regclass,objid,objsubid;
查找到对应的pid之后,使用select pg_terminate_backend(pid);进行终止。
使用greenplum的全局锁检测机制
Greenplum数据库全局死锁检测器后端进程会收集所有segment上的锁信息,并使用有向算法来检测本地死锁和全局死锁是否存在。 该算法使Greenplum数据库放宽对堆表的并发更新和删除限制。 (Greenplum数据库仍然在AO / CO表上使用表级锁定,对UPDATE, DELETE, 和 SELECT…FOR UPDATE的并发操作进行限制。)
默认情况下,全局死锁检测器是被禁用的,Greenplum数据库以串行方式对堆表执行并发更新和删除操作。 可以通过设置配置参数gp_enable_global_deadlock_detector,开启并发更新并让全局死锁检测器检测死锁是否存在。
启用全局死锁检测器后,当启动Greenplum数据库时,master 主机上会自动启动一个后端进程。可以通过 gp_global_deadlock_detector_period配置参数,来设置采集和分析锁等待数据的时间间隔。
如果全局死锁检测器发现了死锁,它会通过取消最新的事务所关联的一个或多个后端进程来避免死锁。
当全局死锁检测器发现了以下事物类型的死锁时,只有一个事务将成功。其他事务将失败,并打印错误指出不允许对同一行进行并发更新。
Greenplum数据库通过配置参数deadlock_timeout
指定本地死锁检测的间隔。由于本地死锁检测和全局死锁检测算法的不同,被死锁检测器终止的进程也不同,这取决于本地死锁检测和全局死锁检测哪个先被触发。
若打开配置参数 lock_timeout,且将数值设定为小于deadlock_timeout
和 gp_global_deadlock_detector_period
,查询会在死锁检测被触发之前就被终止
例子
postgres=# create table user_lock(id int primary key, name text);
CREATE TABLE
postgres=# insert into user_lock values (1,'xiaoming');
INSERT 0 1
会话A
postgres=# begin;
BEGIN
postgres=# update user_lock set name='xiaozhang' where id=1;
UPDATE 1
postgres=# select * from user_lock;
id | name
----+-----------
1 | xiaozhang
(1 row)
postgres=# begin;
BEGIN
postgres=# select * from user_lock;
id | name
----+----------
1 | xiaoming
(1 row)
postgres=# begin;
BEGIN
postgres=# insert into user_lock values (2,'xiaowang');
postgres=# begin;
BEGIN
postgres=# truncate user_lock;
postgres=# begin;
BEGIN
postgres=# select * from user_lock;
with
t_wait as
(
select a.mode,a.locktype,a.database,a.relation,a.page,a.tuple,a.classid,a.granted,
a.objid,a.objsubid,a.pid,a.transactionid,a.mppsessionid,a.mppiswriter,a.gp_segment_id,
b.pid procpid,b.sess_id,b.waiting_reason,b.query current_query,b.xact_start,b.query_start,b.usename,b.datname,b.client_addr,b.client_port,b.application_name
from pg_locks a,pg_stat_activity b where a.mppsessionid=b.sess_id and not a.granted
),
t_run as
(
select a.mode,a.locktype,a.database,a.relation,a.page,a.tuple,a.classid,a.granted,
a.objid,a.objsubid,a.pid,a.transactionid,a.mppsessionid,a.mppiswriter,a.gp_segment_id,
b.pid procpid,b.sess_id,b.waiting_reason,b.query current_query,b.xact_start,b.query_start,b.usename,b.datname,b.client_addr,b.client_port,b.application_name
from pg_locks a,pg_stat_activity b where a.mppsessionid=b.sess_id and a.granted
),
t_overlap as
(
select r.* from t_wait w join t_run r on
(
r.locktype is not distinct from w.locktype and
r.database is not distinct from w.database and
r.relation is not distinct from w.relation and
r.page is not distinct from w.page and
r.tuple is not distinct from w.tuple and
r.transactionid is not distinct from w.transactionid and
r.classid is not distinct from w.classid and
r.objid is not distinct from w.objid and
r.objsubid is not distinct from w.objsubid and
r.mppsessionid <> w.mppsessionid
)
),
t_unionall as
(
select r.* from t_overlap r
union all
select w.* from t_wait w
)
select locktype,datname,relation::regclass,page,tuple,textin(xidout(transactionid)),classid::regclass,objid,objsubid,
string_agg(
'Gp_Segment_Id: '||case when gp_segment_id is null then 'NULL' else gp_segment_id::text end||chr(10)||
'MppIsWriter: '||case when mppiswriter is null then 'NULL' when mppiswriter is true then 'TRUE' else 'FALSE' end||chr(10)||
'MppSessionId: '||case when mppsessionid is null then 'NULL' else mppsessionid::text end||chr(10)||
'ProcPid: '||case when procpid is null then 'NULL' else procpid::text end||chr(10)||
'Pid: '||case when pid is null then 'NULL' else pid::text end||chr(10)||
'Lock_Granted: '||case when granted is null then 'NULL' when granted is true then 'TRUE' else 'FALSE' end||' , Mode: '||case when mode is null then 'NULL' else mode::text end||' , Waiting_Reason: '||case when waiting_reason is null then 'NULL' else waiting_reason::text end||chr(10)||
'Username: '||case when usename is null then 'NULL' else usename::text end||' , Database: '||case when datname is null then 'NULL' else datname::text end||' , Client_Addr: '||case when client_addr is null then 'NULL' else client_addr::text end||' , Client_Port: '||case when client_port is null then 'NULL' else client_port::text end||' , Application_Name: '||case when application_name is null then 'NULL' else application_name::text end||chr(10)||
'Xact_Start: '||case when xact_start is null then 'NULL' else xact_start::text end||' , Query_Start: '||case when query_start is null then 'NULL' else query_start::text end||' , Xact_Elapse: '||case when (now()-xact_start) is null then 'NULL' else (now()-xact_start)::text end||' , Query_Elapse: '||case when (now()-query_start) is null then 'NULL' else (now()-query_start)::text end||chr(10)||
'SQL (Current SQL in Transaction): '||chr(10)||
case when current_query is null then 'NULL' else current_query::text end,
chr(10)||'--------'||chr(10)
order by
( case mode
when 'INVALID' then 0
when 'AccessShareLock' then 1
when 'RowShareLock' then 2
when 'RowExclusiveLock' then 3
when 'ShareUpdateExclusiveLock' then 4
when 'ShareLock' then 5
when 'ShareRowExclusiveLock' then 6
when 'ExclusiveLock' then 7
when 'AccessExclusiveLock' then 8
else 0
end ) desc,
(case when granted then 0 else 1 end)
) as lock_conflict
from t_unionall
group by
locktype,datname,relation::regclass,page,tuple,textin(xidout(transactionid)),classid::regclass,objid,objsubid;
关注gp_segment_id=-1的,长时间等待,杀掉procpid即可
select pg_terminate_backend(67043);
select pg_terminate_backend(66212);
Gp_Segment_Id: -1
MppIsWriter: TRUE
MppSessionId: 102
ProcPid: 67043
Pid: 67043
Lock_Granted: FALSE , Mode: AccessExclusiveLock , Waiting_Reason: lock
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 58145 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:24:08.476479+08 , Query_Start: 2020-03-25 18:24:27.171855+08 , Xact_Elapse: 00:03:35.860149 , Query_Elapse: 00:03:17.164773
SQL (Current SQL in Transaction):
truncate user_lock
--------
Gp_Segment_Id: -1
MppIsWriter: TRUE
MppSessionId: 98
ProcPid: 66212
Pid: 66212
Lock_Granted: TRUE , Mode: ExclusiveLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 57987 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:20:27.018885+08 , Query_Start: 2020-03-25 18:21:27.602971+08 , Xact_Elapse: 00:07:17.317743 , Query_Elapse: 00:06:16.733657
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: -1
MppIsWriter: TRUE
MppSessionId: 98
ProcPid: 66212
Pid: 66212
Lock_Granted: TRUE , Mode: ExclusiveLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 57987 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:20:27.018885+08 , Query_Start: 2020-03-25 18:21:27.602971+08 , Xact_Elapse: 00:07:17.317743 , Query_Elapse: 00:06:16.733657
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: -1
MppIsWriter: TRUE
MppSessionId: 98
ProcPid: 66212
Pid: 66212
Lock_Granted: TRUE , Mode: ExclusiveLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 57987 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:20:27.018885+08 , Query_Start: 2020-03-25 18:21:27.602971+08 , Xact_Elapse: 00:07:17.317743 , Query_Elapse: 00:06:16.733657
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: 0
MppIsWriter: TRUE
MppSessionId: 98
ProcPid: 66212
Pid: 73291
Lock_Granted: TRUE , Mode: RowExclusiveLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 57987 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:20:27.018885+08 , Query_Start: 2020-03-25 18:21:27.602971+08 , Xact_Elapse: 00:07:17.317743 , Query_Elapse: 00:06:16.733657
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: 0
MppIsWriter: TRUE
MppSessionId: 98
ProcPid: 66212
Pid: 73291
Lock_Granted: TRUE , Mode: RowExclusiveLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 57987 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:20:27.018885+08 , Query_Start: 2020-03-25 18:21:27.602971+08 , Xact_Elapse: 00:07:17.317743 , Query_Elapse: 00:06:16.733657
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: 0
MppIsWriter: TRUE
MppSessionId: 98
ProcPid: 66212
Pid: 73291
Lock_Granted: TRUE , Mode: RowExclusiveLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 57987 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:20:27.018885+08 , Query_Start: 2020-03-25 18:21:27.602971+08 , Xact_Elapse: 00:07:17.317743 , Query_Elapse: 00:06:16.733657
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: -1
MppIsWriter: TRUE
MppSessionId: 100
ProcPid: 66491
Pid: 66491
Lock_Granted: FALSE , Mode: RowExclusiveLock , Waiting_Reason: lock
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 58032 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:22:30.667718+08 , Query_Start: 2020-03-25 18:23:01.557594+08 , Xact_Elapse: 00:05:13.66891 , Query_Elapse: 00:04:42.779034
SQL (Current SQL in Transaction):
insert into user_lock values (2,'xiaowang')
--------
Gp_Segment_Id: -1
MppIsWriter: TRUE
MppSessionId: 99
ProcPid: 66467
Pid: 66467
Lock_Granted: TRUE , Mode: AccessShareLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 58030 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:21:57.6995+08 , Query_Start: 2020-03-25 18:22:14.592235+08 , Xact_Elapse: 00:05:46.637128 , Query_Elapse: 00:05:29.744393
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: 0
MppIsWriter: TRUE
MppSessionId: 98
ProcPid: 66212
Pid: 73291
Lock_Granted: TRUE , Mode: AccessShareLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 57987 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:20:27.018885+08 , Query_Start: 2020-03-25 18:21:27.602971+08 , Xact_Elapse: 00:07:17.317743 , Query_Elapse: 00:06:16.733657
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: -1
MppIsWriter: TRUE
MppSessionId: 98
ProcPid: 66212
Pid: 66212
Lock_Granted: TRUE , Mode: AccessShareLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 57987 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:20:27.018885+08 , Query_Start: 2020-03-25 18:21:27.602971+08 , Xact_Elapse: 00:07:17.317743 , Query_Elapse: 00:06:16.733657
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: 0
MppIsWriter: TRUE
MppSessionId: 99
ProcPid: 66467
Pid: 73330
Lock_Granted: TRUE , Mode: AccessShareLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 58030 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:21:57.6995+08 , Query_Start: 2020-03-25 18:22:14.592235+08 , Xact_Elapse: 00:05:46.637128 , Query_Elapse: 00:05:29.744393
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: -1
MppIsWriter: TRUE
MppSessionId: 98
ProcPid: 66212
Pid: 66212
Lock_Granted: TRUE , Mode: AccessShareLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 57987 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:20:27.018885+08 , Query_Start: 2020-03-25 18:21:27.602971+08 , Xact_Elapse: 00:07:17.317743 , Query_Elapse: 00:06:16.733657
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: -1
MppIsWriter: TRUE
MppSessionId: 99
ProcPid: 66467
Pid: 66467
Lock_Granted: TRUE , Mode: AccessShareLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 58030 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:21:57.6995+08 , Query_Start: 2020-03-25 18:22:14.592235+08 , Xact_Elapse: 00:05:46.637128 , Query_Elapse: 00:05:29.744393
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: -1
MppIsWriter: TRUE
MppSessionId: 99
ProcPid: 66467
Pid: 66467
Lock_Granted: TRUE , Mode: AccessShareLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 58030 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:21:57.6995+08 , Query_Start: 2020-03-25 18:22:14.592235+08 , Xact_Elapse: 00:05:46.637128 , Query_Elapse: 00:05:29.744393
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: 0
MppIsWriter: TRUE
MppSessionId: 98
ProcPid: 66212
Pid: 73291
Lock_Granted: TRUE , Mode: AccessShareLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 57987 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:20:27.018885+08 , Query_Start: 2020-03-25 18:21:27.602971+08 , Xact_Elapse: 00:07:17.317743 , Query_Elapse: 00:06:16.733657
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: 0
MppIsWriter: TRUE
MppSessionId: 99
ProcPid: 66467
Pid: 73330
Lock_Granted: TRUE , Mode: AccessShareLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 58030 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:21:57.6995+08 , Query_Start: 2020-03-25 18:22:14.592235+08 , Xact_Elapse: 00:05:46.637128 , Query_Elapse: 00:05:29.744393
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: 0
MppIsWriter: TRUE
MppSessionId: 99
ProcPid: 66467
Pid: 73330
Lock_Granted: TRUE , Mode: AccessShareLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 58030 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:21:57.6995+08 , Query_Start: 2020-03-25 18:22:14.592235+08 , Xact_Elapse: 00:05:46.637128 , Query_Elapse: 00:05:29.744393
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: 0
MppIsWriter: TRUE
MppSessionId: 98
ProcPid: 66212
Pid: 73291
Lock_Granted: TRUE , Mode: AccessShareLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 57987 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:20:27.018885+08 , Query_Start: 2020-03-25 18:21:27.602971+08 , Xact_Elapse: 00:07:17.317743 , Query_Elapse: 00:06:16.733657
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: -1
MppIsWriter: TRUE
MppSessionId: 98
ProcPid: 66212
Pid: 66212
Lock_Granted: TRUE , Mode: AccessShareLock , Waiting_Reason: NULL
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 57987 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:20:27.018885+08 , Query_Start: 2020-03-25 18:21:27.602971+08 , Xact_Elapse: 00:07:17.317743 , Query_Elapse: 00:06:16.733657
SQL (Current SQL in Transaction):
select * from user_lock
--------
Gp_Segment_Id: -1
MppIsWriter: TRUE
MppSessionId: 101
ProcPid: 67023
Pid: 67023
Lock_Granted: FALSE , Mode: AccessShareLock , Waiting_Reason: lock
Username: cabbeenc , Database: postgres , Client_Addr: 172.20.0.11/32 , Client_Port: 58142 , Application_Name: Navicat
Xact_Start: 2020-03-25 18:24:35.455702+08 , Query_Start: 2020-03-25 18:24:47.450631+08 , Xact_Elapse: 00:03:08.880926 , Query_Elapse: 00:02:56.885997
SQL (Current SQL in Transaction):
select * from user_lock
参考: