TRUNCATETABLEHANG(二)

2015-07-24 10:27:41 ? 作者: ? 浏览: 12
keys | relfkeys | relrefs | relhasoids | relhaspkey | relhasrules | relhassubclass | relfrozenxid | relacl | reloptions ------------------------+--------------+----------+----------+-------+-------------+---------------+----------+-----------+---------------+---------------+------------ ---+---------------+-------------+-------------+---------+------------+----------+-----------+-------------+----------+----------+---------+------------+------------+- ------------+----------------+--------------+--------+------------ cannottruncatetable | 17021 | 11051471 | 17010 | 0 | 23496358 | 0 | 16 | 0 | 11052150 | 0 | 0 | 0 | f | f | r | h | 22 | 0 | 0 | 0 | 0 | 0 | f | f | f | f | 1558793687 | | (1 row) gtlions=# select pg_size_pretty(pg_relation_size('gtlions.cannottruncatetable')); pg_size_pretty ---------------- 512 kB (1 row) gtlions=# select pg_backend_pid(); pg_backend_pid ---------------- 14027 (1 row) gtlions=# select now(); now ------------------------------- 2014-10-15 16:52:25.112906+08 (1 row) gtlions=# truncate table gtlions.cannottruncatetable; Cancel request sent ERROR: canceling statement due to user request gtlions=# select now(); now ------------------------------- 2014-10-15 16:53:39.877717+08 (1 row) ###################On the session 2: During the session 1 running, open new session 2, check the session 1 gtlions=# select procpid,sess_id,usename,current_query,waiting,age(now(),query_start) from pg_stat_activity where procpid=14027; procpid | sess_id | usename | current_query | waiting | age ---------+-----------+---------+-----------------------------------------------+---------+----------------- 14027 | 113747736 | gpadmin | truncate table gtlions.cannottruncatetable; | f | 00:00:49.671096 (1 row) gtlions=# select * from pg_locks where pid=14027; locktype | database | relation | page | tuple | transactionid | classid | objid | objsubid | transaction | pid | mode | granted | mppsessionid | mppiswriter | gp_segment_id ---------------+----------+----------+------+-------+---------------+---------+-------+----------+-------------+-------+---------------------+---------+--------------+ -------------+--------------- relation | 17020 | 11052151 | | | | | | | 1658824590 | 14027 | AccessExclusiveLock | t | 113747736 | t | -1 relation | 17020 | 11051470 | | | | | | | 1658824590 | 14027 | ShareLock | t | 113747736 | t | -1 relation | 17020 | 11051470 | | | | | | | 1658824590 | 14027 | AccessExclusiveLock | t | 113747736 | t | -1 relation | 17020 | 11052150 | | | | | | | 1658824590 | 14027 | ShareLock | t | 113747736 | t | -1 relation | 17020 | 11052150 | | | | | | | 1658824590 | 14027 | AccessExclusiveLock | t | 113747736 | t | -1 transactionid | | | | | 1658824590 | | | | 1658824590 | 14027 | ExclusiveLock | t | 113747736 | t | -1 (6 rows) gtlions=# select procpid,sess_id,usename,current_query,waiting,age(now(),query_start) from pg_stat_activity where procpid=14027; procpid | sess_id | usename | current_query | waiting | age ---------+-----------+---------+-----------------------------------------------+---------+----------------- 14027 | 113747736 | gpadmin | truncate table gtlions.cannottruncatetable; | f | 00:01:03.655322 (1 row) gtlions=# select * from pg_locks where pid=14027; locktype | database | relatio
-->

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: