Ordered For Update

From: David Budac <davidbudac_at_gmail.com>
Date: Mon, 21 Nov 2011 02:36:10 -0800 (PST)
Message-ID: <1eda76ef-1cd6-4318-842a-12443c6868ac_at_u6g2000vbg.googlegroups.com>



Hi all,

I've got a question regarding SELECT FOR UPDATE behavior as I couldn't really find any detailed info anywhere. Would anyone know if this feature obeys the ORDER BY clause, while locking the rows? For example, would this query try to lock rows in the desired order?

select * from t1 where some_key = :b1 order by id for update;

According to the plan, the "for update" happens at the top, when the rows should already be ordered. So, is the locking happening in the same order the rows are being fetched? Am I misunderstanding the plan or the concept (or is there some kind of optimization going on behind the scenes)? Any suggestions on how to "trace" this are also very welcome.

Thanks,
David Received on Mon Nov 21 2011 - 04:36:10 CST

Original text of this message