How locking affects performance

Adaptive Server protects the tables, data pages, or data rows used by active transactions by locking them. Locking is a concurrency control mechanism: it ensures the consistency of data within and across transactions. Locking is necessary in a multiuser environment, since several users may be working with the same data at the same time.

Locking affects performance when one process holds locks that prevent another process from accessing needed data. This is called lock contention. The process that is blocked by the lock sleeps until the lock is released.

A more serious impact on performance arises from deadlocks. A deadlock occurs when two user processes each have a lock on a page, row, or table and each process wants to acquire a lock on the page, row, or table held by the other. The transaction with the least accumulated CPU time is killed and all of its work is rolled back.

Understanding the types of locks in Adaptive Server can help to reduce lock contention and avoid or minimize deadlocks.