Postgresql 锁查看
之前版本 PostgreSQL 的 pg_stat_activity 视图的 waiting 字段判断会话是否等待锁资源(通俗地讲, waiting 值为true表示申请不到锁资源处于等待状态),但是并不会给出具体的锁的信息,9.6 版本之后 pg_stat_activity 视图的 waiting 字段被 wait_event_type 和 wait_event 字段取代,这两个字段分别代表等待事件的类型、等待事件名称;
SELECT pid, wait_event_type, wait_event FROM pg_stat_activity;
Wait Event Type | Wait Event Name | Description |
---|---|---|
LWLockNamed | ShmemIndexLock | Waiting to find or allocate space in shared memory. |
OidGenLock | Waiting to allocate or assign an OID. | |
XidGenLock | Waiting to allocate or assign a transaction id. | |
ProcArrayLock | Waiting to get a snapshot or clearing a transaction id at transaction end. | |
SInvalReadLock | Waiting to retrieve or remove messages from shared invalidation queue. | |
SInvalWriteLock | Waiting to add a message in shared invalidation queue. | |
WALBufMappingLock | Waiting to replace a page in WAL buffers. | |
WALWriteLock | Waiting for WAL buffers to be written to disk. | |
ControlFileLock | Waiting to read or update the control file or creation of a new WAL file. | |
CheckpointLock | Waiting to perform checkpoint. | |
CLogControlLock | Waiting to read or update transaction status. | |
SubtransControlLock | Waiting to read or update sub-transaction information. | |
MultiXactGenLock | Waiting to read or update shared multixact state. | |
MultiXactOffsetControlLock | Waiting to read or update multixact offset mappings. | |
MultiXactMemberControlLock | Waiting to read or update multixact member mappings. | |
RelCacheInitLock | Waiting to read or write relation cache initialization file. | |
CheckpointerCommLock | Waiting to manage fsync requests. | |
TwoPhaseStateLock | Waiting to read or update the state of prepared transactions. | |
TablespaceCreateLock | Waiting to create or drop the tablespace. | |
BtreeVacuumLock | Waiting to read or update vacuum-related information for a Btree index. | |
AddinShmemInitLock | Waiting to manage space allocation in shared memory. | |
AutovacuumLock | Autovacuum worker or launcher waiting to update or read the current state of autovacuum workers. | |
AutovacuumScheduleLock | Waiting to ensure that the table it has selected for a vacuum still needs vacuuming. | |
SyncScanLock | Waiting to get the start location of a scan on a table for synchronized scans. | |
RelationMappingLock | Waiting to update the relation map file used to store catalog to filenode mapping. | |
AsyncCtlLock | Waiting to read or update shared notification state. | |
AsyncQueueLock | Waiting to read or update notification messages. | |
SerializableXactHashLock | Waiting to retrieve or store information about serializable transactions. | |
SerializableFinishedListLock | Waiting to access the list of finished serializable transactions. | |
SerializablePredicateLockListLock | Waiting to perform an operation on a list of locks held by serializable transactions. | |
OldSerXidLock | Waiting to read or record conflicting serializable transactions. | |
SyncRepLock | Waiting to read or update information about synchronous replicas. | |
BackgroundWorkerLock | Waiting to read or update background worker state. | |
DynamicSharedMemoryControlLock | Waiting to read or update dynamic shared memory state. | |
AutoFileLock | Waiting to update the postgresql.auto.conf file. | |
ReplicationSlotAllocationLock | Waiting to allocate or free a replication slot. | |
ReplicationSlotControlLock | Waiting to read or update replication slot state. | |
CommitTsControlLock | Waiting to read or update transaction commit timestamps. | |
CommitTsLock | Waiting to read or update the last value set for the transaction timestamp. | |
ReplicationOriginLock | Waiting to setup, drop or use replication origin. | |
MultiXactTruncationLock | Waiting to read or truncate multixact information. | |
LWLockTranche | clog | Waiting for I/O on a clog (transaction status) buffer. |
commit_timestamp | Waiting for I/O on commit timestamp buffer. | |
subtrans | Waiting for I/O a subtransaction buffer. | |
multixact_offset | Waiting for I/O on a multixact offset buffer. | |
multixact_member | Waiting for I/O on a multixact_member buffer. | |
async | Waiting for I/O on an async (notify) buffer. | |
oldserxid | Waiting to I/O on an oldserxid buffer. | |
wal_insert | Waiting to insert WAL into a memory buffer. | |
buffer_content | Waiting to read or write a data page in memory. | |
buffer_io | Waiting for I/O on a data page. | |
replication_origin | Waiting to read or update the replication progress. | |
replication_slot_io | Waiting for I/O on a replication slot. | |
proc | Waiting to read or update the fast-path lock information. | |
buffer_mapping | Waiting to associate a data block with a buffer in the buffer pool. | |
lock_manager | Waiting to add or examine locks for backends, or waiting to join or exit a locking group (used by parallel query). | |
predicate_lock_manager | Waiting to add or examine predicate lock information. | |
Lock | relation | Waiting to acquire a lock on a relation. |
extend | Waiting to extend a relation. | |
page | Waiting to acquire a lock on page of a relation. | |
tuple | Waiting to acquire a lock on a tuple. | |
transactionid | Waiting for a transaction to finish. | |
virtualxid | Waiting to acquire a virtual xid lock. | |
speculative token | Waiting to acquire a speculative insertion lock. | |
object | Waiting to acquire a lock on a non-relation database object. | |
userlock | Waiting to acquire a userlock. | |
advisory | Waiting to acquire an advisory user lock. | |
BufferPin | BufferPin | Waiting to acquire a pin on a buffer. |
- LWLockNamed:表示backend后台进程等待某种特定的轻量级锁;
- LWLockTranche:表示backend后台进程等待一组相关轻量级锁;
- Lock:表示backend后台进程等待重量级的锁,通常是指 relation、tuple、page、transactionid 等子类型锁;
- BufferPin:表示server process 后台进程等待 buffer pin,手册上解释为 Waiting to acquire a pin on a buffer,比较难理解,以后想想如何模拟此场景。
Postgresql 锁查看的更多相关文章
- mysql查看锁查看
关键词:mysql锁争用,mysql锁查看 --------------------- 作者:边城cn 来源:CSDN 原文:https://blog.csdn.net/miyatang/articl ...
- postgresql 锁的定位
今天碰到了一个问题,锁定穷根追底把postgresql的锁研究了一番. 数据库查看锁 可以通过表 pg_locks来查看有哪些锁.sql如下: select a.locktype,a.database ...
- PostgreSQL 锁机制浅析
锁机制在 PostgreSQL 里非常重要 (对于其他现代的 RDBMS 也是如此).对于数据库应用程序开发者(特别是那些涉及到高并发代码的程序员),需要对锁非常熟悉.对于某些问题,锁需要被重点关注与 ...
- PostgreSQL 锁 之 关系级锁
1.关于锁的基本信息 PostgreSQL 有各种各样的技术来锁定某些东西(或者至少是这样称呼的).因此,我将首先用最笼统的术语解释为什么需要锁,可用的锁类型以及它们之间的区别.然后我们将弄清楚 Po ...
- PostgreSQL 锁等待诊断详解
摘要PostgreSQL和大多数传统RDBMS一样,都设计了大量的锁来保证并发操作的数据一致性. 同时PG在设计锁等待时,以队列方式存储等待锁. 参考 ProcSleep()@src/backend/ ...
- 【MySQL】锁——查看当前数据库锁请求的三种方法 20
MySQL提供了查看当前数据库锁请求的三种方法:1. show full processlist命令 观察state和info列 2. show engine innodb status\G ...
- Linux下,postgreSQL的查看与重启
查看命令:ps aux | grep postgresnetstat -npl | grep postgres 方法1: #su - postgres $pg_ctl restart 方法2: #su ...
- PostgreSQL 锁监控
PG>9.2 postgres=# SELECT blocked_locks.pid AS blocked_pid,postgres-# blocked_activity.usename AS ...
- PostgreSQL常用查看命令
1. 查看当前库sehcma大小,并按schema排序 SELECT schema_name, pg_size_pretty(sum(table_size)::bigint) as "dis ...
随机推荐
- LuoguP1126 机器人搬重物(BFS)
题目链接:https://www.luogu.org/problemnew/show/P1126 思路:很不错的搜索题,用BFS,虐了我1天多才A掉 QAQ,细节很多. 1.每个状态包含行.列.方向. ...
- War(最短路+最大流)
War http://acm.hdu.edu.cn/showproblem.php?pid=3599 Time Limit: 2000/1000 MS (Java/Others) Memory ...
- 安装tftp服务器进行文件传输
1. 安装: sudo apt-get install tftp-hpa tftpd-hpa ps: tftpd是服务器,tftp是客户端,客户端能发送和获取,服务器不能动. 2. 配置文件: sud ...
- google thumbnailator
Thumbnailator 是一个优秀的图片处理的Google开源Java类库.处理效果远比Java API的好. 从API提供现有的图像文件和图像对象的类中简化了处理过程,两三行代码就能够从现有图片 ...
- iOS 7.0.2 的bug记录
在iOS 7.0.2 版本上,如果从主屏幕进入webapp且webapp进入全屏模式,那么alert和修改window.location到某产品对应的itunes下载页面则无效. 可参考下面的代码示例 ...
- 03 Maven 坐标与依赖
Maven 坐标与依赖 Maven 的一大功能是管理项目依赖.为了能自动化地解析任何一个 Java 构件, Maven 就必须将它们唯一标识,这就依赖管理的底层基础 一一 坐标.本章将详细分析 Mav ...
- 优质产品需求文档(PRD)写作三大原则
在上一篇文章中有介绍,产品经理的两项主要职责包括:对产品机会进行评估,以及对开发的产品进行评估.而定义即将开发上线的产品,则需要借助产品需求文档,来进行产品的特征和功能描述.PRD文档的写作会因公司. ...
- centos 挂载u盘
1.创建一个目录来挂载U盘 mkdir /mnt/usb #创建usb目录挂载U盘 2.插上U盘,查看移动设备状态 fdisk -l #(注意:参数是小写字母 l 不是数字 1) 会看到类似这一行:/ ...
- 2018.10.16 spoj Can you answer these queries V(线段树)
传送门 线段树经典题. 就是让你求左端点在[l1,r1][l1,r1][l1,r1]之间,右端点在[l2,r2][l2,r2][l2,r2]之间且满足l1≤l2,r1≤r2l1\le l2,r1 \l ...
- 2018.09.01 hdu4405 Aeroplane chess (期望dp)
传送门 期望dp简单题啊. 不过感觉题意不太对. 手过了一遍样例发现如果有捷径必须走. 这样的话就简单了啊. 设f[i]" role="presentation" sty ...