• <fieldset id="8imwq"><menu id="8imwq"></menu></fieldset>
  • <bdo id="8imwq"><input id="8imwq"></input></bdo>
    最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
    問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
    當(dāng)前位置: 首頁 - 科技 - 知識百科 - 正文

    TRUNCATETABLEHANG

    來源:懂視網(wǎng) 責(zé)編:小采 時間:2020-11-09 14:38:49
    文檔

    TRUNCATETABLEHANG

    TRUNCATETABLEHANG:I hava a table gtlions.cannottruncatetable, ZERO rows in this table, i can DELETE from the table, but can not TRUNCATE, hang the statement sql. Detail info below: ###################On the session 1: gtlions=# select version(); version ----
    推薦度:
    導(dǎo)讀TRUNCATETABLEHANG:I hava a table gtlions.cannottruncatetable, ZERO rows in this table, i can DELETE from the table, but can not TRUNCATE, hang the statement sql. Detail info below: ###################On the session 1: gtlions=# select version(); version ----

    I hava a table gtlions.cannottruncatetable, ZERO rows in this table, i can DELETE from the table, but can not TRUNCATE, hang the statement sql. Detail info below: ###################On the session 1: gtlions=# select version(); version ----

    I hava a table gtlions.cannottruncatetable, ZERO rows in this table, i can DELETE from the table, but can not TRUNCATE, hang the statement sql.

    Detail info below:
    ###################On the session 1:
    gtlions=# select version();
     version 
    ------------------------------------------------------------------------------------------------------------------------------------------------------
     PostgreSQL 8.2.15 (Greenplum Database 4.2.5.2 build 1) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on May 16 2013 23:35:01
    (1 row)
    
    gtlions=# \d+ gtlions.cannottruncatetable
     Table "gtlions.cannottruncatetable"
     Column | Type | Modifiers | Storage | Description
    ------------------+------------------------+-----------+----------+-------------
     host_ip | character varying | | extended |
     sys_int_id | numeric | | main |
     hostname | character varying | | extended |
     prog_name | character varying(300) | | extended |
     app_name | character varying | | extended |
     app_name_en | character varying | | extended |
     app_id | numeric(12,0) | | main |
     serverport | numeric(22,0) | | main |
     logpath | numeric(22,0) | | main |
     log_generall | numeric(22,0) | | main |
     log_detail | numeric(22,0) | | main |
     transaction_open | numeric(22,0) | | main |
     generall_open | numeric(22,0) | | main |
     is_use | numeric(22,0) | | main |
     id | numeric(22,0) | | main |
     logmasterswitch | numeric(22,0) | | main |
     process_numb | numeric(22,0) | | main |
     process_total | numeric(22,0) | | main |
     ips_addr | character varying | | extended |
     host_id | numeric(8,0) | | main |
     prog_id | numeric(8,0) | | main |
     prog_apptypeid | numeric(8,0) | | main |
    Has OIDs: no
    Distributed by: (app_id)
    
    gtlions=# select count(*) from gtlions.cannottruncatetable;
     count
    -------
     0
    (1 row)
     
    gtlions=# select * from pg_class where relname='cannottruncatetable';
     relname | relnamespace | reltype | relowner | relam | relfilenode | reltablespace | relpages | reltuples | reltoastrelid | reltoastidxid | relaosegrel
    id | relaosegidxid | relhasindex | relisshared | relkind | relstorage | relnatts | relchecks | reltriggers | relukeys | relfkeys | relrefs | relhasoids | relhaspkey |
    relhasrules | relhassubclass | relfrozenxid | relacl | reloptions
    ------------------------+--------------+----------+----------+-------+-------------+---------------+----------+-----------+---------------+---------------+------------
    ---+---------------+-------------+-------------+---------+------------+----------+-----------+-------------+----------+----------+---------+------------+------------+-
    ------------+----------------+--------------+--------+------------
     cannottruncatetable | 17021 | 11051471 | 17010 | 0 | 23496358 | 0 | 19 | 0 | 11052150 | 0 | 
     0 | 0 | f | f | r | h | 22 | 0 | 0 | 0 | 0 | 0 | f | f |
    f | f | 1558748414 | |
    (1 row)
     
    gtlions=# select pg_size_pretty(pg_relation_size('gtlions.cannottruncatetable'));
     pg_size_pretty
    ----------------
     608 kB
    (1 row)
     
    gtlions=# vacuum analyze gtlions.cannottruncatetable;
    VACUUM
    gtlions=# select * from pg_class where relname='cannottruncatetable';
     relname | relnamespace | reltype | relowner | relam | relfilenode | reltablespace | relpages | reltuples | reltoastrelid | reltoastidxid | relaosegrel
    id | relaosegidxid | relhasindex | relisshared | relkind | relstorage | relnatts | relchecks | reltriggers | relukeys | 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 | 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)
    


    根據(jù)售后的提示說明做以下檢查:
    Truncate table would need a execlusive lock on all the segments to make a sucessfull transaction.

    It seems like there is a lock on some segments that process cant acquire.

    Please follow the below steps and let me know if that helps to identify on which segments is the point of issue.

    Idenifity if the process has acquire all the locks on the segments, like for eg.s

    select procpid,sess_id,current_query from pg_stat_Activity ;
    select * from pg_locks where mppsessionid= and grant='f';

    The second query would tell where it has not able to acquire the lock ( like relation ) , once you find it , you can use the query below to know who is holding it on those segments.

    select * from pg_locks where relation= and granted='t';

    if you find some orphan process on the segments holding locks , try terminating those process ( avoid using kill -9 as it will cause postmaster reset )

    根據(jù)上述步驟我答復(fù)如下:

    Thanks, detail info :
    On the session 1, truncate the table, still hang:
    gtlions=# select pg_backend_pid();
     pg_backend_pid
    ----------------
     14027
    (1 row)
     
    gtlions=# truncate table gtlions.cannottruncatetable;
    Cancel request sent
    ERROR: canceling statement due to user request
     
    On the session 2, check the lock info, not find result for the session:
    gtlions=# select procpid,sess_id,current_query from pg_stat_activity where procpid=14027;
     procpid | sess_id | current_query 
    ---------+-----------+-----------------------------------------------
     14027 | 113747736 | truncate table gtlions.cannottruncatetable;
    (1 row)
     
    gtlions=# select * from pg_locks where mppsessionid=14027;
     locktype | database | relation | page | tuple | transactionid | classid | objid | objsubid | transaction | pid | mode | granted | mppsessionid | mppiswriter | gp_segm
    ent_id
    ----------+----------+----------+------+-------+---------------+---------+-------+----------+-------------+-----+------+---------+--------------+-------------+--------
    -------
    (0 rows)
     
    gtlions=# select * from pg_locks where mppsessionid=14027;
     locktype | database | relation | page | tuple | transactionid | classid | objid | objsubid | transaction | pid | mode | granted | mppsessionid | mppiswriter | gp_segm
    ent_id
    ----------+----------+----------+------+-------+---------------+---------+-------+----------+-------------+-----+------+---------+--------------+-------------+--------
    -------
    (0 rows)
    


    Y的,這也太水了吧,我是在搞不清楚mppsessionid怎么會和那個關(guān)聯(lián)起來。由于SR的Location在愛爾蘭,這會估計人家正在休息,只好自己繼續(xù)摸索:

    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 | | | | | | | 1662808322 | 14027 | AccessExclusiveLock | t | 113747736 |
     t | -1
     transactionid | | | | | 1662808322 | | | | 1662808322 | 14027 | ExclusiveLock | t | 113747736 |
     t | -1
     relation | 17020 | 11051470 | | | | | | | 1662808322 | 14027 | ShareLock | t | 113747736 |
     t | -1
     relation | 17020 | 11051470 | | | | | | | 1662808322 | 14027 | AccessExclusiveLock | t | 113747736 |
     t | -1
     relation | 17020 | 11052150 | | | | | | | 1662808322 | 14027 | ShareLock | t | 113747736 |
     t | -1
     relation | 17020 | 11052150 | | | | | | | 1662808322 | 14027 | AccessExclusiveLock | t | 113747736 |
     t | -1
    (6 rows)
     
    gtlions=# select * from pg_locks where relation='gtlions.cannottruncatetable'::regclass;
     locktype | database | relation | page | tuple | transactionid | classid | objid | objsubid | transaction | pid | mode | granted | mppsessionid | mppi
    swriter | gp_segment_id
    ----------+----------+----------+------+-------+---------------+---------+-------+----------+-------------+-------+---------------------+---------+--------------+-----
    --------+---------------
     relation | 17020 | 11051470 | | | | | | | 1662808322 | 14027 | ShareLock | t | 113747736 | t 
     | -1
     relation | 17020 | 11051470 | | | | | | | 1662808322 | 14027 | AccessExclusiveLock | t | 113747736 | t 
     | -1
     relation | 17020 | 11051470 | | | | | | | 2653373155 | 15567 | AccessExclusiveLock | f | 113747736 | t 
     | 0
     relation | 17020 | 11051470 | | | | | | | 0 | 13773 | AccessShareLock | t | 75284454 | f 
     | 0
     relation | 17020 | 11051470 | | | | | | | 2653366790 | 15569 | AccessExclusiveLock | f | 113747736 | t 
     | 1
     relation | 17020 | 11051470 | | | | | | | 0 | 13789 | AccessShareLock | t | 75284454 | f 
     | 1
     relation | 17020 | 11051470 | | | | | | | 0 | 13807 | AccessShareLock | t | 75284454 | f 
     | 2
     relation | 17020 | 11051470 | | | | | | | 2653175988 | 15572 | AccessExclusiveLock | f | 113747736 | t 
     | 2
     relation | 17020 | 11051470 | | | | | | | 0 | 13830 | AccessShareLock | t | 75284454 | f 
     | 3
     relation | 17020 | 11051470 | | | | | | | 2653198212 | 15577 | AccessExclusiveLock | f | 113747736 | t 
     | 3
     relation | 17020 | 11051470 | | | | | | | 2653197212 | 15583 | ShareLock | t | 113747736 | t 
     | 4
     relation | 17020 | 11051470 | | | | | | | 2653197212 | 15583 | AccessExclusiveLock | t | 113747736 | t 
     | 4
     relation | 17020 | 11051470 | | | | | | | 0 | 13858 | AccessShareLock | t | 75284454 | f 
     | 5
     relation | 17020 | 11051470 | | | | | | | 2653196128 | 15589 | AccessExclusiveLock | f | 113747736 | t 
     | 5
     relation | 17020 | 11051470 | | | | | | | 0 | 13091 | AccessShareLock | t | 75284454 | f 
     | 6
     relation | 17020 | 11051470 | | | | | | | 2653195038 | 16256 | AccessExclusiveLock | f | 113747736 | t 
     | 6
     relation | 17020 | 11051470 | | | | | | | 0 | 13098 | AccessShareLock | t | 75284454 | f 
     | 7
    gtlions=# select * from pg_locks where relation='gtlions.cannottruncatetable'::regclass and pid!=14027;
     locktype | database | relation | page | tuple | transactionid | classid | objid | objsubid | transaction | pid | mode | granted | mppsessionid | mppi
    swriter | gp_segment_id
    ----------+----------+----------+------+-------+---------------+---------+-------+----------+-------------+-------+---------------------+---------+--------------+-----
    --------+---------------
     relation | 17020 | 11051470 | | | | | | | 2653373155 | 15567 | AccessExclusiveLock | f | 113747736 | t 
     | 0
     relation | 17020 | 11051470 | | | | | | | 0 | 13773 | AccessShareLock | t | 75284454 | f 
     | 0
     relation | 17020 | 11051470 | | | | | | | 2653366790 | 15569 | AccessExclusiveLock | f | 113747736 | t 
     | 1
     relation | 17020 | 11051470 | | | | | | | 0 | 13789 | AccessShareLock | t | 75284454 | f 
     | 1
     relation | 17020 | 11051470 | | | | | | | 0 | 13807 | AccessShareLock | t | 75284454 | f 
     | 2
     relation | 17020 | 11051470 | | | | | | | 2653175988 | 15572 | AccessExclusiveLock | f | 113747736 | t 
     | 2
     relation | 17020 | 11051470 | | | | | | | 0 | 13830 | AccessShareLock | t | 75284454 | f 
     | 3
     relation | 17020 | 11051470 | | | | | | | 2653198212 | 15577 | AccessExclusiveLock | f | 113747736 | t 
     | 3
     relation | 17020 | 11051470 | | | | | | | 2653197212 | 15583 | ShareLock | t | 113747736 | t 
     | 4
     relation | 17020 | 11051470 | | | | | | | 2653197212 | 15583 | AccessExclusiveLock | t | 113747736 | t 
     | 4
     relation | 17020 | 11051470 | | | | | | | 0 | 13858 | AccessShareLock | t | 75284454 | f 
     | 5
     relation | 17020 | 11051470 | | | | | | | 2653196128 | 15589 | AccessExclusiveLock | f | 113747736 | t 
     | 5
     relation | 17020 | 11051470 | | | | | | | 0 | 13091 | AccessShareLock | t | 75284454 | f 
     | 6
     relation | 17020 | 11051470 | | | | | | | 2653195038 | 16256 | AccessExclusiveLock | f | 113747736 | t 
     | 6
     relation | 17020 | 11051470 | | | | | | | 0 | 13098 | AccessShareLock | t | 75284454 | f 
     | 7
     relation | 17020 | 11051470 | | | | | | | 2653223811 | 16258 | AccessExclusiveLock | f | 113747736 | t 
     | 7
     relation | 17020 | 11051470 | | | | | | | 2653164802 | 16261 | ShareLock | t | 113747736 | t 
     | 8
     relation | 17020 | 11051470 | | | | | | | 2653164802 | 16261 | AccessExclusiveLock | t | 113747736 | t 
     | 8
     relation | 17020 | 11051470 | | | | | | | 2653228628 | 16266 | AccessExclusiveLock | f | 113747736 | t 
     | 9
     relation | 17020 | 11051470 | | | | | | | 0 | 13118 | AccessShareLock | t | 75284454 | f 
     | 9
     relation | 17020 | 11051470 | | | | | | | 2653420396 | 16271 | AccessExclusiveLock | f | 113747736 | t 
     | 10
     relation | 17020 | 11051470 | | | | | | | 0 | 13135 | AccessShareLock | t | 75284454 | f 
     | 10
     relation | 17020 | 11051470 | | | | | | | 2653180874 | 16277 | AccessExclusiveLock | f | 113747736 | t 
     | 11
     relation | 17020 | 11051470 | | | | | | | 0 | 13146 | AccessShareLock | t | 75284454 | f 
     | 11
     relation | 17020 | 11051470 | | | | | | | 2653191613 | 8822 | ShareLock | t | 113747736 | t 
     | 12
     relation | 17020 | 11051470 | | | | | | | 2653191613 | 8822 | AccessExclusiveLock | t | 113747736 | t 
     | 12
     relation | 17020 | 11051470 | | | | | | | 2653137608 | 8824 | ShareLock | t | 113747736 | t 
     | 13
     relation | 17020 | 11051470 | | | | | | | 2653137608 | 8824 | AccessExclusiveLock | t | 113747736 | t 
     | 13
     relation | 17020 | 11051470 | | | | | | | 2653170505 | 8827 | AccessExclusiveLock | f | 113747736 | t 
     | 14
     relation | 17020 | 11051470 | | | | | | | 0 | 19567 | AccessShareLock | t | 75284454 | f 
     | 14
     relation | 17020 | 11051470 | | | | | | | 2653146597 | 8832 | ShareLock | t | 113747736 | t 
     | 15
     relation | 17020 | 11051470 | | | | | | | 2653146597 | 8832 | AccessExclusiveLock | t | 113747736 | t 
     | 15
     relation | 17020 | 11051470 | | | | | | | 2653166445 | 8838 | AccessExclusiveLock | f | 113747736 | t 
     | 16
     relation | 17020 | 11051470 | | | | | | | 0 | 19593 | AccessShareLock | t | 75284454 | f 
     | 16
     relation | 17020 | 11051470 | | | | | | | 2653165327 | 8844 | ShareLock | t | 113747736 | t 
     | 17
     relation | 17020 | 11051470 | | | | | | | 2653165327 | 8844 | AccessExclusiveLock | t | 113747736 | t 
     | 17
     relation | 17020 | 11051470 | | | | | | | 2653219764 | 11121 | ShareLock | t | 113747736 | t 
     | 18
     relation | 17020 | 11051470 | | | | | | | 2653219764 | 11121 | AccessExclusiveLock | t | 113747736 | t 
     | 18
     relation | 17020 | 11051470 | | | | | | | 2653227486 | 11123 | AccessExclusiveLock | f | 113747736 | t 
     | 19
     relation | 17020 | 11051470 | | | | | | | 0 | 15309 | AccessShareLock | t | 75284454 | f 
     | 19
     relation | 17020 | 11051470 | | | | | | | 2653155802 | 11125 | AccessExclusiveLock | f | 113747736 | t 
     | 20
     relation | 17020 | 11051470 | | | | | | | 0 | 15320 | AccessShareLock | t | 75284454 | f 
     | 20
     relation | 17020 | 11051470 | | | | | | | 0 | 15330 | AccessShareLock | t | 75284454 | f 
     | 21
     relation | 17020 | 11051470 | | | | | | | 2653185053 | 11131 | AccessExclusiveLock | f | 113747736 | t 
     | 21
     relation | 17020 | 11051470 | | | | | | | 2653157522 | 11137 | AccessExclusiveLock | f | 113747736 | t 
     | 22
     relation | 17020 | 11051470 | | | | | | | 0 | 15341 | AccessShareLock | t | 75284454 | f 
     | 22
     relation | 17020 | 11051470 | | | | | | | 2653151279 | 11143 | ShareLock | t | 113747736 | t 
     | 23
     relation | 17020 | 11051470 | | | | | | | 2653151279 | 11143 | AccessExclusiveLock | t | 113747736 | t 
     | 23
    (48 rows)
     
    gtlions=# select distinct pid from pg_locks where relation='gtlions.cannottruncatetable'::regclass and pid!=14027;
     pid 
    -------
     8822
     8824
     8827
     8832
     8838
     8844
     11121
     11123
     11125
     11131
     11137
     11143
     13091
     13098
     13118
     13135
     13146
     13773
     13789
     13807
     13830
     13858
     15309
     15320
     15330
     15341
     15567
     15569
     15572
     15577
     15583
     15589
     16256
     16258
     16261
     16266
     16271
     16277
     19567
     19593
    (40 rows)
     
    gtlions=# select procpid,sess_id,current_query,query_start, backend_start,client_addr,application_name from pg_Stat_activity where procpid in (select distinct pid from pg_locks where relation='gtlions.cannottruncatetable'::r
    gtlions.b-# ;
     procpid | sess_id | current_query | query_start | backend_start | client_addr | application_name
    ---------+---------+---------------+-------------+---------------+-------------+------------------
    (0 rows)
     
    gtlions=# select procpid,sess_id,current_query,query_start, backend_start,client_addr,application_name from pg_Stat_activity where procpid in (select distinct pid from pg_locks where relation='gtlions.cannottruncatetable'::regclass and pid!=14027); procpid | sess_id | current_query | query_start | backend_start | client_addr | application_name
    ---------+---------+---------------+-------------+---------------+-------------+------------------
    (0 rows)
    終于發(fā)現(xiàn)了點異常情況,這個對象被不存在的會話進(jìn)程鎖住了,頓時覺得有希望了。
    午飯過后發(fā)現(xiàn)數(shù)據(jù)庫被重啟了,我F**K。。。自然而然再次執(zhí)行truncate是沒有問題了,白白丟失了一次可以繼續(xù)摸索的機(jī)會。
    附:還有的疑惑就是,之前曾經(jīng)使用alter table rename to 是沒有問題的,而這個命令和truncate應(yīng)是持有同樣級別的鎖,按理來說不應(yīng)該一個成功一個失敗。

    聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

    文檔

    TRUNCATETABLEHANG

    TRUNCATETABLEHANG:I hava a table gtlions.cannottruncatetable, ZERO rows in this table, i can DELETE from the table, but can not TRUNCATE, hang the statement sql. Detail info below: ###################On the session 1: gtlions=# select version(); version ----
    推薦度:
    標(biāo)簽: g table truncate
    • 熱門焦點

    最新推薦

    猜你喜歡

    熱門推薦

    專題
    Top
    主站蜘蛛池模板: 久久久久人妻一区精品色| 伊人 久久 精品| 日韩人妻精品无码一区二区三区| 亚洲综合国产精品| 午夜精品美女自拍福到在线| 亚洲国产91精品无码专区 | 无码国模国产在线无码精品国产自在久国产 | 99精品国产一区二区| 国产精品三级在线观看无码| 日本精品久久久久久久久免费| 93精91精品国产综合久久香蕉| 精品国产成人在线| 国产成人精品在线观看| 99久久精品国产高清一区二区| 骚片AV蜜桃精品一区| 国产亚洲精品xxx| 国产亚洲精品不卡在线| 精品福利一区二区三| 久久精品无码av| 久久久精品国产sm调教网站| 女人高潮内射99精品| 国产午夜精品理论片久久| 亚洲精品乱码久久久久久蜜桃图片| 合区精品中文字幕| 国产精品自在在线午夜福利| 青青青青久久精品国产h| 久久国产香蕉一区精品 | 日本欧美国产精品第一页久久| 91麻豆精品视频| 国产精品免费AV片在线观看| 久久精品国产99久久无毒不卡| 国内精品久久久久久久coent| 91国内外精品自在线播放| 精品国产成人在线| 97久久综合精品久久久综合| 欧美日韩综合精品| 亚洲国产精品久久久久网站| 一区二区三区四区精品视频| 四虎精品影院永久在线播放| 亚洲精品国产成人99久久| 2022精品天堂在线视频|