Senior
Why does SELECT FOR UPDATE SKIP LOCKED work worse in Oracle compared to PostgreSQL?
sobes.tech AI
Answer from AI
In Oracle, the implementation of SELECT FOR UPDATE SKIP LOCKED differs from PostgreSQL in terms of internal locking mechanisms and query planner, which can lead to worse performance and less predictable behavior.
Main reasons:
- Locking mechanism: In Oracle, locks are implemented at the row level using system structures, which can result in higher overhead when frequently using
SKIP LOCKED. - Query planner: Oracle may generate execution plans that are less optimal for scenarios with many competing transactions and skipping locked rows.
- Behavior when skipping: In PostgreSQL,
SKIP LOCKEDefficiently bypasses locked rows, minimizing wait times, whereas in Oracle, additional delays may occur due to implementation specifics.