Re: INSERT...ON DUPLICATE KEY IGNORE - Mailing list pgsql-hackers

From Gavin Flower
Subject Re: INSERT...ON DUPLICATE KEY IGNORE
Date
Msg-id 52279B3B.2020404@archidevsys.co.nz
Whole thread Raw
In response to Re: INSERT...ON DUPLICATE KEY IGNORE  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
<div class="moz-cite-prefix">On 05/09/13 08:26, Robert Haas wrote:<br /></div><blockquote
cite="mid:CA+TgmoYrJxbRTha_+fbwH=TsiudgSb5Ze7iXe8=jwJkB9PV9PA@mail.gmail.com"type="cite"><pre wrap="">On Sat, Aug 31,
2013at 2:34 PM, Andres Freund <a class="moz-txt-link-rfc2396E"
href="mailto:andres@2ndquadrant.com"><andres@2ndquadrant.com></a>wrote:
 
</pre><blockquote type="cite"><pre wrap="">After some thinking I don't think any solution primarily based on
holding page level locks across other index operations is going to scale
ok.
</pre></blockquote><pre wrap="">
I'd like to chime in with a large +1 for this sentiment and pretty
much everything else Andres said further downthread.  The operations
across which you're proposing to hold buffer locks seem at least an
order of magnitude too complex to get away with something like that.
Concurrent readers will block in a non-interruptible wait if they try
to access a buffer, and that's a situation that will be intolerable
if, for example, it can persist across a disk I/O.  And I don't see
any way to avoid that.

One possible alternative to inserting promises into the index pages
themselves might be to use some kind of heavyweight lock.  The way
that SIREAD locks work is not entirely dissimilar to what's needed
here, I think.  Of course, the performance implications of checking
for lots of extra locks during inserts could be pretty bad, so you'd
probably need some way of avoiding that in common cases, which I don't
know exactly how to do, but maybe there's a way.

</pre></blockquote><font size="-1">How about an 'Expensive bit' (of course, renamed to sound more professional and to
betterindicate what it <font size="-1">does!</font>) - if the bit is set, the<font size="-1">n do the e<font
size="-1">x</font>pensiveprocessing.</font></font>  This should have minimal impact for the common case, so extensive
checkingwould only be required when lots of locks need to be checked.<br /><br /> I strongly suspect that the
situation,is way more complicated, than I imply above - but possibly, a more sophisticated version of the above might
help?<br/> 

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: INSERT...ON DUPLICATE KEY IGNORE
Next
From: Tomas Vondra
Date:
Subject: Re: [rfc] overhauling pgstat.stat