On Thu, Jan 27, 2005 at 03:31:29PM +1100, Neil Conway wrote:
> You could perhaps relax the uniqueness of the index during the
> transaction itself, and keep around some backend-local indication of
> which index entries it have been inserted. Then at transaction-commit
> you'd need to re-check the inserted index entries to verify that they
> are unique. It would be nice to just keep a pin on the leaf page that we
> inserted into, although we'd need to take care to follow subsequent page
> splits (could we use the existing L & Y techniques to do this?).
Maybe we can do something like
1. use a boolean-returning unique insertion. If it fails, returns
false, doesn't ereport(ERROR); if it works, inserts and returns true.
2. the caller checks the return value. If false, records the insertion
attempt into an should-check-later list.
3. at transaction end, unique insertion is tried again with the items on
the list. If it fails, the transaction is aborted.
It's only a SMOC, nothing difficult AFAICS. Disk-spilling logic
included, because it'd be probably needed.
--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
Si no sabes adonde vas, es muy probable que acabes en otra parte.