Re: DELETE with LIMIT (or my first hack) - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject Re: DELETE with LIMIT (or my first hack)
Date
Msg-id 4CF554CC.9040708@cs.helsinki.fi
Whole thread Raw
In response to Re: DELETE with LIMIT (or my first hack)  (Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>)
Responses Re: DELETE with LIMIT (or my first hack)
List pgsql-hackers
While reading this thread, I thought of two things I think we could do 
if this feature was implemented:
 1. Sort large UPDATE/DELETEs so it is done in heap order

This is actually a TODO item.  I imagine it would be possible to do 
something like:

DELETE FROM foo USING (...) ORDER BY ctid;

with this patch to help this case.
 2. Reducing deadlocks in big UPDATE/DELETEs

One problem that sometimes occurs when doing multiple multi-row UPDATEs 
or DELETEs concurrently is that the transactions end up working on the 
same rows, but in a different order.  One could use an ORDER BY clause 
to make sure the transactions don't deadlock.

Thoughts?


Regards,
Marko Tiikkaja


pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: DELETE with LIMIT (or my first hack)
Next
From: Tom Lane
Date:
Subject: KNNGIST next step: adjusting indexAM API