Andres Freund wrote:
> This is implemented using a new infrastructure called "speculative
> insertion". It is an optimistic variant of regular insertion that first
> does a pre-check for existing tuples and then attempts an insert. If a
> violating tuple was inserted concurrently, the speculatively inserted
> tuple is deleted and a new attempt is made. If the pre-check finds a
> matching tuple the alternative DO NOTHING or DO UPDATE action is taken.
> If the insertion succeeds without detecting a conflict, the tuple is
> deemed inserted.
Is there a reason why heap_finish_speculative and heap_abort_speculative
were made to take a HeapTuple rather than just an ItemPointer? They
only use tuple->t_self in their code (except the former, which in an
assert verifies that the tuple is indeed speculative).
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services