Re: FOR KEY LOCK foreign keys
Alvaro Herrera <alvherre@commandprompt.com>
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2011-07-27T23:16:44Z
Lists: pgsql-hackers
Attachments
- fklocks-2.patch (application/octet-stream)
Hackers, This is an updated version of the patch I introduced here: http://archives.postgresql.org/message-id/1294953201-sup-2099@alvh.no-ip.org Mainly, this patch addresses the numerous comments by Noah Misch here: http://archives.postgresql.org/message-id/20110211071322.GB26971@tornado.leadboat.com My thanks to Noah for the very exhaustive review and ideas. I also removed the bit about copying the ComboCid to the new version of the tuple during an update. I think that must have been the result of very fuzzy thinking; I cannot find any reasoning that leads to it being necessary, or even correct. I also included Marti Raudsepp's patch to consider only indexes usable in foreign keys. One thing I have not addressed is Noah's idea about creating a new lock mode, KEY UPDATE, that would let us solve the initial problem that this patch set to resolve in the first place. I am not clear on exactly how that is to be implemented, because currently heap_update and heap_delete do not grab any kind of lock but instead do their own ad-hoc waiting. I think that might need to be reshuffled a bit, to which I haven't gotten yet, and is a radical enough idea that I would like it to be discussed by the hackers community at large before setting sail on developing it. In the meantime, this patch does improve the current situation quite a lot. -- Álvaro Herrera <alvherre@commandprompt.com> The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support