Re: foreign key locks, 2nd attempt

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: foreign key locks, 2nd attempt
Date: 2012-03-15 22:23:32
Message-ID: CA+U5nMLX7oOMnO_T+xbf0iBbp90r=XfvsNtqDN+cema+MYXhKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 15, 2012 at 10:13 PM, Alvaro Herrera
<alvherre(at)commandprompt(dot)com> wrote:
>
> Excerpts from Simon Riggs's message of jue mar 15 19:04:41 -0300 2012:
>>
>> On Thu, Mar 15, 2012 at 9:54 PM, Alvaro Herrera
>> <alvherre(at)commandprompt(dot)com> wrote:
>> >
>> > Excerpts from Simon Riggs's message of jue mar 15 18:38:53 -0300 2012:
>> >> On Thu, Mar 15, 2012 at 2:26 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> >
>> >> > But that would only make sense if
>> >> > we thought that getting rid of the fsyncs would be more valuable than
>> >> > avoiding the blocking here, and I don't.
>> >>
>> >> You're right that the existing code could use some optimisation.
>> >>
>> >> I'm a little tired, but I can't see a reason to fsync this except at checkpoint.
>> >
>> > Hang on.  What fsyncs are we talking about?  I don't see that the
>> > multixact code calls any fsync except that checkpoint and shutdown.
>>
>> If a dirty page is evicted it will fsync.
>
> Ah, right.
>
>> >> Also seeing that we issue 2 WAL records for each RI check. We issue
>> >> one during MultiXactIdCreate/MultiXactIdExpand and then immediately
>> >> afterwards issue a XLOG_HEAP_LOCK record. The comments on both show
>> >> that each thinks it is doing it for the same reason and is the only
>> >> place its being done. Alvaro, any ideas why that is.
>> >
>> > AFAIR the XLOG_HEAP_LOCK log entry only records the fact that the row is
>> > being locked by a multixact -- it doesn't record the contents (member
>> > xids) of said multixact, which is what the other log entry records.
>>
>> Agreed. But issuing two records when we could issue just one seems a
>> little strange, especially when the two record types follow one
>> another so closely - so we end up queuing for the lock twice while
>> holding the lock on the data block.
>
> Hmm, that seems optimization that could be done separately.

Oh yes, definitely not something for you to add to the main patch.

Just some additional tuning to alleviate Robert's concerns.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Farina 2012-03-15 22:34:35 Re: Faster compression, again
Previous Message Robert Haas 2012-03-15 22:18:18 Re: logging in high performance systems.