Is there a way to select rows in Postgresql that aren\'t locked? I have a multi-threaded app that will do:
Select... order by id desc limit 1 for update
What are you trying to accomplish? Can you better explain why neither unlocked row updates nor full transactions will do what you want?
Better yet, can you prevent contention and simply have each thread use a different offset? This won't work well if the relevant portion of the table is being updated frequently; you'll still have collisions but only during heavy insert load.
Select... order by id desc offset THREAD_NUMBER limit 1 for update