foreign key locks

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: foreign key locks
Date: 2012-06-14 16:41:39
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


This is v12 of the foreign key locks patch.

I gave a talk about this patch at PGCon:
There is an article there that explains this patch.

I described the original goal of this in the thread starting here:

The patch itself was first submitted here:

There were many problems that we had to shake off during the 9.2
development cycle; this new version covers most of them. There is a
github clone here: branch fklocks
If you see the "compare" view, changes in this submission that weren't
present in v11 start with commit 19dc85f1, here:

I know of one significant issue left, possible cause of nasty bugs,
which is the way this patch interacts with EvalPlanQual. I mentioned
erroneously in my PGcon talk that the way we handle this is by shutting
off EPQ recursion -- this was wrong. What I did was shut off
heap_lock_tuple from following the update chain, letting it walk only in
the cases where it comes from high-level callers. Others such as EPQ,
which do their own update-chain walking, do not request locks to follow
update. I believe this is correct. This was changed in this commit:

There is also a matter of a performance regression we measured in stock
pgbench. I have profiled this to come from GetMultiXactMembers and
AFAICS the way to fix it is to improve multixact.c's cache of old
multis. Right now we ditch the cache at end of transaction, which was
already considered wrong in comments in the code but never fixed. I am
going to make the cache entries live until the oldest Xid in each multi
is below its visibility horizon (so RecentXmin for multis that only
contain locks, and something like FreezeLimit for multis that contain

I apologize for the size of this patch. I am not really sure that there
are pieces to split out for separate review.

Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>

Attachment Content-Type Size
fklocks-12.patch.gz application/x-gzip 88.4 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2012-06-14 16:54:04 Re: Minimising windows installer password confusion
Previous Message Robert Haas 2012-06-14 16:38:54 Re: Minimising windows installer password confusion