9) Locking in Mysql
9) Locking in Mysql
9) Locking in Mysql
Ajenda
Locking in MySQL
Internal Locking
Table level Locking
Row level Locking
External Locking
Dead Lock
About Us
Karthik.P.R, Senior MySQL DBA,
Bharath Kumar.P, MySQL DBA
Blog : remotemysqldba.blogspot.in
Locking In MySQL
It places a lock on data on behalf of one client to restrict access by other clients to the
To reduce the contention of queries waiting for a single resource locking is needed.
Remotemysqldba.blogspot.in
Internal Locking
Internal Locking:
It is performed inside the server itself to avoid the contention by multiple
threads. It does not involve any programs.
Internal Locking Types:
The internal locking is of two types namely .
a) Table level locking
b) Row level locking
The internal locking is maintained within the mysql itself. It helps in managing
the contention between the connections.
Remotemysqldba.blogspot.in
Remotemysqldba.blogspot.in
Disadvantages
Remotemysqldba.blogspot.in
Remotemysqldba.blogspot.in
table_locks_immediate
table_locks_waited
Table_locks_immediate : The number of locks that are granted immediately on
the request for it.
Table_locks_waited : The number of locks that are granted after waiting .
Remotemysqldba.blogspot.in
Remotemysqldba.blogspot.in
Disadvantages :
-Consumes more system resource .
-Slower when a larger part of the table is locked.
-Dead locks occurs.
Remotemysqldba.blogspot.in
External Locking
External locking is the use of file system locking to manage contention for
MyISAM database tables by multiple processes.
Remotemysqldba.blogspot.in
Dead Lock
Dead is a situation in which two or more competing actions are each
waiting for the other to finish, and thus neither ever does.
A condition that occurs when two processes are each waiting for the
other to complete before proceeding. The result is that both
processes hang. Deadlocks occur most commonly
in multitaskingand client/server environments. Ideally, the programs
that are deadlocked.
Two transaction waiting for a rows which are locked by each other .
Remotemysqldba.blogspot.in
Dead Locking
Remotemysqldba.blogspot.in
THANK YOU
Remotemysqldba.blogspot.in