Re: BUG #12469: pg_locks shows locks held by pids not found i n pg_stat_activity or ps - Mailing list pgsql-bugs

From Kevin Grittner
Subject Re: BUG #12469: pg_locks shows locks held by pids not found i n pg_stat_activity or ps
Date
Msg-id 1511260135.4208486.1420826855952.JavaMail.yahoo@jws10056.mail.ne1.yahoo.com
Whole thread Raw
In response to BUG #12469: pg_locks shows locks held by pids not found i n pg_stat_activity or ps  (kop@meme.com)
Responses Re: BUG #12469: pg_locks shows locks held by pids not found i n pg_stat_activity or ps  ("Karl O. Pinc" <kop@meme.com>)
Re: BUG #12469: pg_locks shows locks held by pids not found i n pg_stat_activity or ps  (Marko Tiikkaja <marko@joh.to>)
List pgsql-bugs
"kop@meme.com" <kop@meme.com> wrote:

> I found that after running a large transaction (for days, it's still
> running) and then running out of shared memory that pg_locks reports locks
> held by pids that do not seem to exist, either in ps output or in
> pg_stat_activity.

That is not a bug.  For details see either of the below links:

http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/storage/lmgr/README-SSI;hb=master

http://vldb.org/pvldb/vol5/p1850_danrkports_vldb2012.pdf

The short explanation is that SIReadLocks on a serializable
transaction may need to be kept until overlapping transactions
terminate.  You can minimize this by flagging transactions which
will not modify data as READ ONLY.  If a READ ONLY transaction is
expected to run for a very long time, it is wise to also flag it as
DEFERRABLE.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgsql-bugs by date:

Previous
From: kop@meme.com
Date:
Subject: BUG #12469: pg_locks shows locks held by pids not found i n pg_stat_activity or ps
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #9923: "reassign owned" does not change permissions grantor