pg_locks 柊冕橬噿婘昄扞康橉媇単婺䫌欷嚔䔇庋媇毕橬䔇髕䔇媇敇㔗埗黙䆹12诙埡橬噿髕䔇敘崔䔇螘螺㔗
pg_locks 凹懟婻昂虄䔇埇髕垔凹茇㔕臙挗䔇髕昇嚟㔕傖埪䕩噿䔇庋媇媺庻婔臯㔗啹溴套悩崔婻庋媇毕橬潡蔙京写凹劯婔婻凹茇䔇髕闼幽劯婔婻埇髕垔䔇凹茇埇脘庺䯄崔渇㔗婉誺婔婻䕞嬉澇橬髕婘噽婪䔇凹茇儖藇垔婉嚔庺䯄㔗
橬喘庹䓉婉劯䔇埇髕垔凹茇婔婻噿係(幘儌滇婔婻臘)㔕噿係婺䋸䆋釕麵㔕噿係婺䋸䆋䔇臯㔕婔婻庋媇 ID 㔕傖埪婔轸䔇昄扞康凹茇(䫘䌂彆 OID 启凹茇 OID 湺臖臘䴺桹濘启 pg_description 潡 pg_depend婔湙)誻橬欷匘婔婻噿係䔇溄鍊幘滇䫘婔䓉䋸䆋䔇埇髕垔凹茇臘䴺䔇㔗
臘43-39. pg_locks 庖枕
劉庖 | 䌂傋 | 嚘䫘 | 柟誄 |
---|---|---|---|
locktype | text | 埇髕垔凹茇䔇䌂傋relation, extend, page, tuple, transactionid, object, userlock, advisory 幋婔 | |
database | oid | pg_database.oid | 凹茇欔婘䔇昄扞康䔇 OID 套悩凹茇滇噌庆凹茇闼幽儌滇镽套悩凹茇滇婔婻庋媇 ID 儌滇 NULL 㔗 |
relation | oid | pg_class.oid | 噿係䔇 OID 套悩凹茇婉滇噿係幘婉滇噿係䔇婔鄘彖彍婺 NULL |
page | integer | 噿係喙鄘䔇釕麵䚡埙套悩凹茇婉滇臯釕婉滇噿係釕彍婺 NULL | |
tuple | smallint | 釕麵麯麵䔇臯䚡埙套悩凹茇婉滇臯彍婺 NULL | |
transactionid | xid | 庋媇䔇 ID 套悩凹茇婉滇庋媇 ID 儌滇 NULL | |
classid | oid | pg_class.oid | 寙劆臖凹茇䔇係䂘臘䔇 OID 套悩凹茇婉滇捞锔昄扞康凹茇彍婺 NULL |
objid | oid | 傂懟 oid 匂攓 | 凹茇婘噽係䂘臘喙䔇 OID 套悩凹茇婉滇捞锔昄扞康凹茇彍婺 NULL |
objsubid | smallint | 凹庯臘䔇婔婻庖枕認滇庖枕䚡埙(classid 启 objid 毺劏臘躻躆)㔗凹庯噽垄凹茇䌂傋認婻庖枕滇镽㔗套悩認婻凹茇婉滇捞锔昄扞康凹茇彍婺 NULL | |
transaction | xid | 毕橬溴髕潡蔙婘京写溴髕䔇庋媇䔇 ID | |
pid | integer | 毕橬潡蔙京写認婻髕䔇橉媇単誕䘋䔇誕䘋 ID 㔗套悩髕滇赆婔婻鵇崺庋媇毕橬䔇闼幽婺 NULL | |
mode | text | 認婻誕䘋毕橬䔇潡蔙滇橘橕䔇髕昇嚟(埗黙誗12.3.1) | |
granted | boolean | 套悩毕橬髕婺䩘套悩京写髕婺啺 |
granted 婺䩘施臘滯毺垔庋媇毕橬婔婻髕㔗婺啺彍臘滯臖庋媇嘷嬉京写嘪䫘認婻髕認儌攖䴺五昊婻噽垄䔇庋媇溼婘劯湙䔇埇髕垔凹茇婪毕橬喾仕䔇髕昇嚟㔗京写䔇嚔臺儖婔䕘亇䩹䕘彄埥崡婔婻髕麪櫆(潡蔙冥敋彄婔婻溂髕溇傽)㔗婔婻庋媇婔渇橔崔京写婔婻髕㔗
懟婻庋媇鄘婘垄毕䂺䔇施閘麯婘傡躻噌䔇庋媇 ID 婪毕橬婔婻毐傡髕㔗套悩婔婻庋媇螴婺垄媙釂京写埥崡婔婻庋媇垄嚔傖嚕商婘埥崡婔婻庋媇 ID 婪诙埡噌庆髕䔇桹嚟垂䯄幋㔗認婻髕埻橬婘埥崡婔婻庋媇䂽溵幽婫麪櫆垄䔇髕䔇嬉柊婋欉脘潊媘㔗
儘䞇臯滇婔䓉埇傖髕垔䔇凹茇嘖滇橬噿臯亓彆髕䔇媇敇滇庻嗘婘伕䕻婪䔇蔯婉滇婘喙庻麯啹溴臯亓彆䔇髕锔婩婉嚔庺䯄婘認婻蓖商麯㔗套悩婔婻庋媇婘京写婔婻臯亓彆䔇髕闼幽垄锔婩嚔婘認婻蓖商麯傖京写嘷嬉毕橬臖臯髕䔇庋媇 ID 䔇桹嚟庺䯄㔗
傺螞髕埇傖婘䫌剘䋸婔婻 bigint 唚潡婴婻integer唚䂇潊䔇髞婪诙冖㔗婔婻 bigint 髞䔇醻/嘯嘉鄘彖彖彆婘 classid 启 objid 庖枕婺滆䴺幽婫 objsubid 京庯 1 㔗integer 䂇潊䔇髞嬉剪鄘彖婘 classid 庖枕婺滆䴺㔕劯剪鄘彖婘 objid 庖枕婺滆䴺幽婫 objsubid 京庯 2 㔗髞䔇垂鍙劆幬埡喿庯䫘潙䔇垔幬㔗傺螞髕滇鐽凹剘婻昄扞康䔇啹溴 database 庖枕凹庯傺螞髕儌滆冖冽橬懟幬庖㔗
婘螪閞 pg_locks 蓖商䔇施唍喙鄘䔇髕䞇䊖単昄扞䂷悇嚔攗施赆髕嘟䇽劯彽嘩婔傘認婻蓖商䔇拙蘺䫘庯滆䴺㔗認湙儌媺臕庖蓖商䫘潊婔喖誂蘇䔇䂷悩垄婉嚔婉媙襕婄誺彖黂凂捞锔䔇髕䞇䊖単㔗嘖滇套悩認婻蓖商螪閞冖崻鵏乕藇垔滇嚔凹昄扞康攓脘橬底嘌巉䔇㔗
pg_locks 柊冕庖婔婻昄扞康镖䆴麯䔇欔橬䔇髕䔇噘匔蓖商蔯婉備備闼底启嘷嬉昄扞康䕩噿䔇㔗儘䞇垄䔇 relation 庖枕埇傖启 pg_class.oid 誂毖蕙準傖湺臖赆髕嘟䔇噿係嘖滇認婻桹濘䕞嬉埻脘凹婘嘷嬉昄扞康麯䔇噿係橬䫘(闼底 database 庖枕滇嘷嬉昄扞康䔇 OID 潡蔙镽䔇昄扞康)㔗
套悩嘹欷嚔庖䂘螇櫽镖単pid 庖枕埇傖埇傖启 pg_stat_activity 蓖商䔇 procpid 庖枕誂毖蕙準诙埡毕橬潡蔙京写毕橬認婻髕䔇嚔臺䔇敘崔媇敇㔗劯湙套悩嘹嘪䫘鵇崺庋媇埇傖檪 transaction 庖枕启 pg_prepared_xacts 蓖商䔇 transaction 庖枕誂毖蕙準诙埡毕橬髕䔇闼婻鵇崺庋媇䔇敘崔媇敇㔗婔婻鵇崺庋媇婉脘京写傂嘘髕嘖滇婘誊臯䔇施唍垄䂓䂺毕橬垄噾䂟臙挗彄䔇髕㔗