what is difference between read lock and accesslock?

Database
Enthusiast

what is difference between read lock and accesslock?

Hi
can any one tell me exactly what is a accesslock?

1)suppose if i apply a lock for select statement it is readlock upto myknowledge.
2)suppose if i apply a lock for a insert/update/delete statement it is write lock upto my knowledge.
3)suppose if i apply a lock at database level it is exclusive lock i think not sure.

then what is accesslock?

if i read any document every one is discussing about compatability of locks like read lock is compatable with access and readlocks.
no one exactly explaining what a access lock?
can any pls explain clearly?
suppose if i am wrong in the first 3 statements pls correct me.

i asked 5-6 of question in the forum.no one is responding to my questions.
even though my question seems silly for you people, pls explain wit a little bit patience..

regards,
bujji.

4 REPLIES
Enthusiast

Re: what is difference between read lock and accesslock?

Hi,
Access lock is one wherein the table is not locked means you can do insert/update/delete on the table while access lock will access the table ,in this the dirty reads may happen means you will not get the latest changes whatever happened on table to be reflected in your answerset.
For access lock to be placed we have to specify it explicitly as LOCKING FOR ACCESS.
READ lock will lock the table wherein you can not do insert/update and structural changes in table.
It is placed by simple SELECT statement for by explicitly specifying as LOCKING FOR READ.
hope this makes your doubt clear.
Enthusiast

Re: what is difference between read lock and accesslock?

Hi Rupesh,
Thanks for ur response.

u r explanation is good. but still lit bit of confusion going on in my mind.

suppose if user A applied access lock on table T,then if user B access the table,
then he cant view the latest data from table T.

Is this what ur tring to explain or do u think still i did nt understand it properly?

If i am still wrong pls explain elobarately.

Rupesh,
pls try to answer my remaining questions in the same forum.
i moved into a teradata project recently. i am tring to learn to teradata with the help of some NCR refenece document and with the help of some friends.
as i am new to teradata, some one clarifies my doubts will be really useful to me.

regards,
bujji.

Enthusiast

Re: what is difference between read lock and accesslock?

The main diffrence between read lock and access lock is data Intergrity.On placing a read lock the user expects data intergrity, while as for access lock the user cannot expect data integrity.

Consider 2 senarios

1. User A places READ lock and User B WRITE places lock

User B will have to wait for User A to complete its read inorder to start insert/updates/deletes on the data.

2. User A places ACCESS lock and User B WRITE places lock.

User A & B access the data simultneously, hence User A cannot expect to get consistent results.
Enthusiast

Re: what is difference between read lock and accesslock?

Further more, We have row level lock in TERADATA.
'LOCKING ROW FOR ACCESS' : This is related to row hash lock. A row hash lock applies to a set of rows that shares the same hash code. It does not necessarily, nor even generally, lock only one row.