1. 引言
PostgreSQL的页锁,在官网上的介绍很简单,简单来说就是用于控制对buffer pool中的page的读/写访问,在行被读取或更新完成后,就释放这些锁。应用开发者一般不用考虑这个锁,但是也有必要了解一下其中的原理,DBA路漫漫
In addition to table and row locks, page-level share/exclusive locks are used to control read/write access to table pages in the shared buffer pool. These locks are released immediately after a row is fetched or updated. Application developers normally need not be concerned with page-level locks, but they are mentioned here for completeness. |
2. 页锁
在PostgreSQL9.6以后,pg_stat_activity视图里面多了两个字段,wait_event_type和wait_event,其中wait_event里面就有LWLock,注解都很清晰
在README里面,做了解释
目前在PostgreSQL12中预定了这么多LWLock