If we consider these locks only from blocking perspective then behavior of HUT lock and Transaction Lock are same.
- For example,
- 1) A read lock prevents another job from claiming a write lock or exclusive lock.
- 2)A write lock prevents a read lock, write lock, or exclusive lock.
- 3) An exclusive lock prevents any other type of lock.
- Conflicting HUT and transaction locks on an object block each other, just as if both were transaction locks or both were HUT locks.
The two differences between transaction locks and HUT locks are:
Permanence:
A transaction lock exists only for the duration of a transaction; after the transaction completes or is aborted, the lock is released. A HUT lock is more permanent. It is only removed if an explicit RELEASE LOCK command is issued, or if the locking operation completes successfully
Scope:
Transaction lock has session scope
i.e. it applies to any command submitted by the session running the locking transaction. Another session running against the same object(s) must claim its own locks, even if it is running under the same user
HUT lock has users scope
i.e. it applies to any Teradata ARC operation that the user is performing on the object. A user must have only one HUT lock against an object at a time. The HUT lock allows any Teradata ARC operation from that user to access the locked object(s), but blocks other users from acquiring a conflicting HUT lock on the object(s).
Permanence:
A transaction lock exists only for the duration of a transaction; after the transaction completes or is aborted, the lock is released. A HUT lock is more permanent. It is only removed if an explicit RELEASE LOCK command is issued, or if the locking operation completes successfully
Scope:
Transaction lock has session scope
i.e. it applies to any command submitted by the session running the locking transaction. Another session running against the same object(s) must claim its own locks, even if it is running under the same user
HUT lock has users scope
i.e. it applies to any Teradata ARC operation that the user is performing on the object. A user must have only one HUT lock against an object at a time. The HUT lock allows any Teradata ARC operation from that user to access the locked object(s), but blocks other users from acquiring a conflicting HUT lock on the object(s).