Assume a huge table with several hundred million records and columns are well indexed. Is there any performance concern between
SELECT * from HUGE_TABLE where ... AND ... FOR UPDATE
and
SELECT * from HUGE_TABLE where ... AND ...
the main reason for the FOR UPDATE
clause is because we may have several instance of the application running the same query at same time, but need to avoid update conflicts.
At this point is there I concern about two performance issue: 1. if there is no other query running, is select for update
slower?. 2. if there are many other active query to select / update
on the huge table, what will be the performance to this entire situation on this table (also update in the question)
SELECT ... FOR UPDATE
creates at least two performance issues compared to a regular SELECT
:
FOR UPDATE
works by making a small update to each relevant block. It acts like a regular change in some ways, and will create redo and undo records as you can see by running queries like select used_urec from gv$transaction;
. Depending on how many rows are locked, this could be significantly more expensive than a regular SELECT
, even if no other sessions are involved.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.