Mysql Programmer Applications Database Server: Create Procedure Syntax
Mysql Programmer Applications Database Server: Create Procedure Syntax
Stored
Procedure is a set of statements, which allow ease and flexibility for a programmer because
stored procedure is easy to execute than reissuing the number of individual SQL statements.
Stored procedure can call another stored procedure also. Stored Procedure can very useful
where multiple client applications are written in different languages or it can be work on
different platforms but they need to perform the same database operations.
Store procedure can improve the performance because by using the stored procedure less
information needs to be sent between the server and the client. It increase the load on the
database server because less work is done on the client side and much work is done on the
server side.
CREATE PROCEDURE Syntax
The general syntax of Creating a Stored Procedure is :
CREATE PROCEDURE proc_name ([proc_parameter[......]]) routine_body
proc_name : procedure name
proc_parameter : [ IN | OUT | INOUT ] param_name type
routine_body : Valid SQL procedure statement
The parameter list is available with in the parentheses. Parameter can be declared to use any
valid data type, except that the COLLATE attribute cannot be used. By default each
parameter is an IN parameter. For specifying other type of parameter used the OUT or
INOUT keyword before the parameter name.
An IN parameter is used to pass the value into a procedure. The procedure can be change the
value but when the procedure return the value then modification is not visible to the caller.
An OUT parameter is used to pass the value from the procedure to the caller but its visible to
the caller. An INOUT parameter is initialized by the caller and it can be modified by the
procedure, and any change made by the procedure is visible to the caller.
For each OUT or INOUT parameter you have to pass a user –defined variable because then
the procedure returns the value then only you can obtain it values. But if you invoking the
procedure from the other procedure then you can also pass a routine parameter or variable as
an IN or INOUT parameter.
The routine_body contains the valid SQL procedure statement that can be a simple statement
like SELECT or INSERT or they can be a compound statement written using BEGIN and
END. Compound statement can consists declarations, loops or other control structure.
Now we are describing you a example of a simple stored procedure which uses an OUT
parameter. It uses the mysql client delimiter command for changing the statement delimiter
from ; to // till the procedure is being defined. Example :
mysql> delimiter //
mysql> CREATE PROCEDURE Sproc(OUT p1
INT)
-> SELECT COUNT(*) INTO p1 FROM
Emp;
-> //
Query OK, 0 rows affected (0.21 sec)
mysql> delimiter ;
mysql> CALL Sproc(@a);
Query OK, 0 rows affected (0.12 sec)
mysql> select @a;
+------+
| @a |
+------+
| 5 |
+------+
1 row in set (0.00 sec)
VIEW is a virtual table, which acts like a table but actually it contains no data. That is based
on the result set of a SELECT statement. A VIEW consists rows and columns from one or
more than one tables. A VIEW is a query that’s stored as an object. A VIEW is nothing more
than a way to select a subset of table’s columns.
When you defined a view then you can reference it like any other table in a database. A
VIEW provides as a security mechanism also. VIEWS ensures that users are able to modify
and retrieve only that data which seen by them.
By using Views you can ensure about the security of data by restricting access to the
following data:
• Specific columns of the tables.
• Specific rows of the tables.
• Specific rows and columns of the tables.
• Subsets of another view or a subset of views and tables
• Rows fetched by using joins.
• Statistical summary of data in a given tables.
CREATE VIEW Statement
CREATE VIEW Statement is used to create a new database view. The general syntax of
CREATE VIEW Statement is:
CREATE VIEW view_name [(column_list)] [WITH ENCRYPTION] AS
select_statement [WITH CHECK OPTION]
View_name specifies the name for the new view. column_list specifies the name of the
columns to be used in view. column_list must have the same number of columns that
specified in select_statement. If column_list option is not available then view is created with
the same columns that specified in select_statement.
WITH ENCRYPTION option encrypts the text to the view in the syscomments table.
AS option specifies the action that is performed by the view. select_statement is used to
specify the SELECT statement that defines a view. The optional WITH CHECK OPTION
clause applies to the data modification statement like INSERT and UPDATE statements to
fulfill the criteria given in the select_statement defining the view. This option also ensures
that the data can visible after the modifications are made permanent.
Some restrictions imposed on views are given below :
• A view can be created only in the current database.
• The view name must follow the rules for identifiers and
• The view name must not be the same as that of the base table
• A view can be created only that time if there is a SELECT permission on its base
table.
• A SELECT INTO statement cannot be used in view declaration statement.
• A trigger or an index cannot be defined on a view.
• The CREATE VIEW statement cannot be combined with other SQL statements in a
single batch.
Example :
In the following example we have two table Client and Products. And if you want to see only
those client records that are active in Products table also means right now they are supplying
us the products. For this we are creating the view by the name of Supp_Client.
mysql> SELECT * FROM Client;
+------+---------------
+----------+
| C_ID | Name | City
|
+------+---------------
+----------+
| 1 | A K Ltd | Delhi
|
| 2 | V K Associate |
Mumbai |
| 3 | R K India |
Banglore |
| 4 | R S P Ltd |
Kolkata |
| 5 | A T Ltd | Delhi
|
| 6 | D T Info | Delhi
|
+------+---------------
+----------+
6 rows in set (0.00 sec)
mysql> SELECT * FROM Products;
+---------+-------------
+------+
| Prod_ID | Prod_Detail | C_ID
|
+---------+-------------
+------+
| 111 | Monitor | 1
|
| 112 | Processor | 2
|
| 113 | Keyboard | 2
|
| 114 | Mouse | 3
|
| 115 | CPU | 5
|
+---------+-------------
+------+
5 rows in set (0.00 sec)
Sometimes you required the data from more than one table. When you select the data from
more than one table this is known as Joining. A join is a SQL query that is used to select the
data from more than one table or views. When you define multiple tables or views in the
FROM clause of a query the MySQL performs a join that linking the rows from multiple
tables together.
Types of Joins :
• INNER Joins
• OUTER Joins
• SELF Joins
We are going to describe you the Join with the help of following two tables :
mysql> SELECT * FROM
Client;
+------+---------------
+----------+
| C_ID | Name |
City |
+------+---------------
+----------+
| 1 | A K Ltd |
Delhi |
| 2 | V K Associate |
Mumbai |
| 3 | R K India |
Banglore |
| 4 | R S P Ltd |
Kolkata |
+------+---------------
+----------+
4 rows in set (0.00 sec)
mysql> SELECT * FROM
Products;
+---------+-------------
+------+
| Prod_ID | Prod_Detail |
C_ID |
+---------+-------------
+------+
| 111 | Monitor | 1
|
| 112 | Processor | 2
|
| 113 | Keyboard | 2
|
| 114 | Mouse | 3
|
| 115 | CPU | 5
|
+---------+-------------
+------+
5 rows in set (0.00 sec)
INNER Joins
The INNER join is considered as the default Join type. Inner join returns the column values
from one row of a table combined with the column values from one row of another table that
satisfy the search condition for the join. The general syntax of INNER Join is :
SELECT <column_name1>, <column_name2> FROM <tbl_name> INNER JOIN
<tbl_name> ON <join_conditions>
The following example takes all the records from table Client and finds the matching records
in table Product. But if no match is found then the record from table Client is not included in
the results. But if multiple results are found in table Product with the given condition then
one row will be return for each.
Example :
mysql> SELECT * FROM Client
-> INNER JOIN Products
-> ON Client.C_ID=Products.C_ID;
+------+---------------+----------
+---------+-------------+------+
| C_ID | Name | City | Prod_ID
| Prod_Detail | C_ID |
+------+---------------+----------
+---------+-------------+------+
| 1 | A K Ltd | Delhi | 111
| Monitor | 1 |
| 2 | V K Associate | Mumbai | 112
| Processor | 2 |
| 2 | V K Associate | Mumbai | 113
| Keyboard | 2 |
| 3 | R K India | Banglore | 114
| Mouse | 3 |
+------+---------------+----------
+---------+-------------+------+
4 rows in set (0.04 sec)
OUTER Joins
Sometimes when we are performing a Join between the two tables, we need all the records
from one table even there is no corresponding record in other table. We can do this with the
help of OUTER Join. In other words an OUTER Join returns the all rows that returned by an
INNER Join plus all the rows from one table that did not match any row from the other table.
Outer Join are divided in two types : LEFT OUTER Join, RIGHT OUTER Join
LEFT OUTER Join
LEFT OUTER Join is used to return all the rows that returned by an INNER Join plus all the
rows from first table that did not match with any row from the second table but with the
NULL values for each column from second table. The general syntax of LEFT OUTER Join
is :
SELECT <column_name1>, <column_name2> FROM <tbl_name> LEFT OUTER
JOIN <tbl_name> ON <join_conditions>
In the following example we are selected every row from the Client table which don’t have a
match in the Products Table. Example :
mysql> SELECT * FROM CLIENT
-> LEFT OUTER JOIN Products
-> ON Client.C_ID=Products.C_ID;
+------+---------------+----------
+---------+-------------+------+
| C_ID | Name | City | Prod_ID
| Prod_Detail | C_ID |
+------+---------------+----------
+---------+-------------+------+
| 1 | A K Ltd | Delhi | 111
| Monitor | 1 |
| 2 | V K Associate | Mumbai | 112
| Processor | 2 |
| 2 | V K Associate | Mumbai | 113
| Keyboard | 2 |
| 3 | R K India | Banglore | 114
| Mouse | 3 |
| 4 | R S P Ltd | Kolkata | NULL
| | NULL |
+------+---------------+----------
+---------+-------------+------+
5 rows in set (0.00 sec)
In the following example we are using the ORDER BY Clause with the LEFT OUTER Join.
mysql> SELECT * FROM Client
-> LEFT OUTER JOIN Products
-> ON Client.C_ID=Products.C_ID
-> ORDER BY Client.City;
+------+---------------+----------
+---------+-------------+------+
| C_ID | Name | City | Prod_ID
| Prod_Detail | C_ID |
+------+---------------+----------
+---------+-------------+------+
| 3 | R K India | Banglore | 114
| Mouse | 3 |
| 1 | A K Ltd | Delhi | 111
| Monitor | 1 |
| 4 | R S P Ltd | Kolkata | NULL
| | NULL |
| 2 | V K Associate | Mumbai | 113
| Keyboard | 2 |
| 2 | V K Associate | Mumbai | 112
| Processor | 2 |
+------+---------------+----------
+---------+-------------+------+
5 rows in set (0.08 sec)
In the result of LEFT OUTER Join " R S P Ltd " is included even though it has no rows in the
Products table.
RIGHT OUTER Join
RIGHT OUTER Join is much same as the LEFT OUTER JOIN. But RIGHT OUTER Join is
used to return all the rows that returned by an INNER Join plus all the rows from second
table that did not match with any row from the first table but with the NULL values for each
column from first table. The general syntax of RIGHT OUTER Join is :
SELECT <column_name1>, <column_name2> FROM <tbl_name> RIGHT OUTER
JOIN <tbl_name> ON <join_conditions>
In the following example we are selected every row from the Products table which don’t have
a match in the Client Table. Example :
mysql> SELECT * FROM Client
-> RIGHT OUTER JOIN Products
-> ON Client.C_ID=Products.C_ID;
+------+---------------+----------+---------
+-------------+------+
| C_ID | Name | City | Prod_ID
| Prod_Detail | C_ID |
+------+---------------+----------+---------
+-------------+------+
| 1 | A K Ltd | Delhi | 111
| Monitor | 1 |
| 2 | V K Associate | Mumbai | 112
| Processor | 2 |
| 2 | V K Associate | Mumbai | 113
| Keyboard | 2 |
| 3 | R K India | Banglore | 114
| Mouse | 3 |
| NULL | | | 115
| CPU | 5 |
+------+---------------+----------+---------
+-------------+------+
5 rows in set (0.03 sec)
SELF Join
SELF Join means a table can be joined with itself. SELF Join is useful when we want to
compare values in a column to other values in the same column. For creating a SELF Join we
have to list a table twice in the FROM clause and assign it a different alias each time. For
referring the table we have to use this aliases.
The following example provide you the list of those Clients that belongs to same city of
C_ID=1.
mysql> SELECT b.C_ID,b.Name,b.City FROM
Client a, Client b
-> WHERE a.City=b.City AND a.C_ID=1;
+------+----------+-------+
| C_ID | Name | City |
+------+----------+-------+
| 1 | A K Ltd | Delhi |
| 5 | A T Ltd | Delhi |
| 6 | D T Info | Delhi |
+------+----------+-------+
3 rows in set (0.00 sec)
we can write this SELF JOIN Query in Subquery like this also :
mysql> SELECT * FROM Client
-> WHERE City=(
-> SELECT City FROM
Client
-> WHERE C_ID=1);
+------+----------+-------+
| C_ID | Name | City |
+------+----------+-------+
| 1 | A K Ltd | Delhi |
| 5 | A T Ltd | Delhi |
| 6 | D T Info | Delhi |
+------+----------+-------+
3 rows in set (0.03 sec)
Cursors are used when the SQL Select statement is expected to return more than one row.
Cursors are supported inside procedures and functions. Cursors must be declared and its
definition contains the query. The cursor must be defined in the DECLARE section of the
program. A cursor must be opened before processing and close after processing.
Triggers:
A Trigger is a named database object which defines some action that the database should
take when some databases related event occurs. Triggers are executed when you issues a data
manipulation command like INSERT, DELETE, UPDATE on a table for which the trigger
has been created. They are automatically executed and also transparent to the user. But for
creating the trigger the user must have the CREATE TRIGGER privilege. In this section we
will describe you about the syntax to create and drop the triggers and describe you some
examples of how to use them.
CREATE TRIGGER
The general syntax of CREATE TRIGGER is :
CREATE TRIGGER trigger_name trigger_time trigger_event ON tbl_name FOR
EACH ROW trigger_statement
By using above statement we can create the new trigger. The trigger can associate only with
the table name and that must be refer to a permanent table. Trigger_time means trigger
action time. It can be BEFORE or AFTER. It is used to define that the trigger fires before or
after the statement that executed it. Trigger_event specifies the statement that executes the
trigger. The trigger_event can be any of the DML Statement : INSERT, UPDATE, DELETE.
We can not have the two trigger for a given table, which have the same trigger action time
and event. For Instance : we cannot have two BEFORE INSERT triggers for same table. But
we can have a BEFORE INSERT and BEFORE UPDATE trigger for a same table.
Trigger_statement have the statement that executes when the trigger fires but if you want to
execute multiple statement the you have to use the BEGIN…END compound statement.
We can refer the columns of the table that associated with trigger by using the OLD and
NEW keyword. OLD.column_name is used to refer the column of an existing row before it
is deleted or updated and NEW.column_name is used to refer the column of a new row that
is inserted or after updated existing row.
In INSERT trigger we can use only NEW.column_name because there is no old row and in
a DELETE trigger we can use only OLD.column_name because there is no new row. But in
UPDATE trigger we can use both, OLD.column_name is used to refer the columns of a row
before it is updated and NEW.Column_name is used to refer the column of the row after it is
updated.
In the following example we are updating the Salary column of Employee table before
inserting any record in Emp table. Example :
mysql> SELECT * FROM Employee;
+-----+---------+----------+-------------------
+--------+-------+
| Eid | Ename | City | Designation |
Salary | Perks |
+-----+---------+----------+-------------------
+--------+-------+
| 1 | Rahul | Delhi | Manager |
10300 | 853 |
| 2 | Gaurav | Mumbai | Assistant Manager |
10300 | 853 |
| 3 | Chandan | Banglore | Team Leader |
15450 | 999 |
| 5 | Tapan | Pune | Developer |
20600 | 1111 |
| 6 | Amar | Chennai | Developer |
16000 | 1124 |
| 7 | Santosh | Delhi | Designer |
10000 | 865 |
| 8 | Suman | Pune | Web Designer |
20000 | 658 |
+-----+---------+----------+-------------------
+--------+-------+
7 rows in set (0.00 sec)
mysql> delimiter //
mysql> CREATE TRIGGER ins_trig BEFORE INSERT ON Emp
-> FOR EACH ROW
-> BEGIN
-> UPDATE Employee SET Salary=Salary-300 WHERE
Perks>500;
-> END;
-> //
Query OK, 0 rows affected (0.01 sec)
mysql> delimiter ;
mysql> INSERT INTO Emp
VALUES(9,'Rajesh','Delhi','Developer',15000,658);
Query OK, 1 row affected (0.05 sec)
mysql> SELECT * FROM Employee;
+-----+---------+----------+-------------------
+--------+-------+
| Eid | Ename | City | Designation |
Salary | Perks |
+-----+---------+----------+-------------------
+--------+-------+
| 1 | Rahul | Delhi | Manager |
10000 | 853 |
| 2 | Gaurav | Mumbai | Assistant Manager |
10000 | 853 |
| 3 | Chandan | Banglore | Team Leader |
15150 | 999 |
| 5 | Tapan | Pune | Developer |
20300 | 1111 |
| 6 | Amar | Chennai | Developer |
15700 | 1124 |
| 7 | Santosh | Delhi | Designer |
9700 | 865 |
| 8 | Suman | Pune | Web Designer |
19700 | 658 |
+-----+---------+----------+-------------------
+--------+-------+
7 rows in set (0.00 sec)
In the following example we are modifying the salary of Employee table before updating the
record of the same table. Example :
mysql> delimiter //
mysql> CREATE TRIGGER updtrigger BEFORE UPDATE ON
Employee
-> FOR EACH ROW
-> BEGIN
-> IF NEW.Salary<=500 THEN
-> SET NEW.Salary=10000;
-> ELSEIF NEW.Salary>500 THEN
-> SET NEW.Salary=15000;
-> END IF;
-> END
-> //
Query OK, 0 rows affected (0.01 sec)
mysql> delimiter ;
mysql> UPDATE Employee
-> SET Salary=500;
Query OK, 5 rows affected (0.04 sec)
Rows matched: 7 Changed: 5 Warnings: 0
mysql> SELECT * FROM Employee;
+-----+---------+----------+-------------------
+--------+-------+
| Eid | Ename | City | Designation |
Salary | Perks |
+-----+---------+----------+-------------------
+--------+-------+
| 1 | Rahul | Delhi | Manager |
10000 | 853 |
| 2 | Gaurav | Mumbai | Assistant Manager |
10000 | 853 |
| 3 | Chandan | Banglore | Team Leader |
10000 | 999 |
| 5 | Tapan | Pune | Developer |
10000 | 1111 |
| 6 | Amar | Chennai | Developer |
10000 | 1124 |
| 7 | Santosh | Delhi | Designer |
10000 | 865 |
| 8 | Suman | Pune | Web Designer |
10000 | 658 |
+-----+---------+----------+-------------------
+--------+-------+
7 rows in set (0.00 sec)
mysql> UPDATE Employee
-> SET Salary=1500;
Query OK, 7 rows affected (0.03 sec)
Rows matched: 7 Changed: 7 Warnings: 0
mysql> SELECT * FROM Employee;
+-----+---------+----------+-------------------
+--------+-------+
| Eid | Ename | City | Designation |
Salary | Perks |
+-----+---------+----------+-------------------
+--------+-------+
| 1 | Rahul | Delhi | Manager |
15000 | 853 |
| 2 | Gaurav | Mumbai | Assistant Manager |
15000 | 853 |
| 3 | Chandan | Banglore | Team Leader |
15000 | 999 |
| 5 | Tapan | Pune | Developer |
15000 | 1111 |
| 6 | Amar | Chennai | Developer |
15000 | 1124 |
| 7 | Santosh | Delhi | Designer |
15000 | 865 |
| 8 | Suman | Pune | Web Designer |
15000 | 658 |
+-----+---------+----------+-------------------
+--------+-------+
7 rows in set (0.01 sec)
DROP TRIGGER
The general syntax of DROP TRIGGER is :
DROP TRIGGER trigger_name
This statement is used to drop a trigger. Example of Dropping the Trigger :
mysql> DROP TRIGGER updtrigger;
Query OK, 0 rows affected (0.02 sec)
LOCKING:
MySQL can manage the contention for table contents by using Locking :
• Internal Locking can be performed in the MySQL server itself for managing the
contention for table content by multiple threads. This locking is known as internal
because this locking is performed entirely by the server and it does not involve any
other programs.
• External locking is performed when server and other programs lock the table files for
coordinating among themselves which program may access the tables at which time.
Internal Locking Methods
In this section we are describing you about internal locking, Internal Locking is performed in
the MySQL server itself for managing the contention for table content by multiple threads.
This locking is known as internal because this locking is performed entirely by the server and
it does not involve any other programs.
Table – level locking is used by MySQL to MyISAM and MEMORY, row – level locking for
InnoDB tables and page – level locking for BDB tables. In some cases you can guess which
locking is best for an application but generally is not easy to say that a given lock is better
than another lock type. Actually everything is depend on the application because different
parts of application can required different lock types. For deciding this, if you are using
storage engine with row – level locking then you must look at what application does and what
is the combination of update and select statements it uses.
MySQL uses table level locking for storage engines. In MySQL table locking is deadlock
free. Deadlock prevention can be managed by requesting all required lock at once at the
beginning of query and the lock the tables in the same order.
MySQL grants the table WRITE locks are given below:
• When locks are not available on the table then put a write lock on the table.
• Else in the write lock queue put a lock request.
MySQL grants the table READ locks are given below:
• When write locks are not available on the table then put a read lock on the table.
• Else in the read lock queue put a lock request
After releasing the lock, lock is available for the threads in the write lock queue and then for
the threads in read lock queue. For analyzing the contention of table lock we check the
Table_locks_immediate and Table_locks_waited status variables :
mysql> show status like 'Table%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| Table_locks_immediate | 12 |
| Table_locks_waited | 0 |
+-----------------------+-------+
2 rows in set (0.00 sec)
InnoDB and BDB type tables uses row locks and page locks respectively. All locking are
deadlock free except of these two because they acquire the lock between the processing of
SQL statements rather than the beginning of transaction.
Row level locking advantages are given below:
• In row level locking we can lock a single row for a long time.
• We can do fewer changes to rollback also.
• And fewer lock conflicts when accessing different rows in many threads.
Row level locking disadvantages are given below:
• This type of locking needs more memory than table or page level locking.
• When we used this type of locking on a large part of the table then its slower than
table or page level locking because we have to acquire many more locks.
Table locks are more useful rather than page or row level locks in the following cases:
• When most of the statements for the tables are reads.
• When statements to a table are a combination of reads and writes and writes are
deletes or updates to a single row, which can be fetched with one key read.
• When SELECT statement mixed with INSERT and few DELETE or UPDATE
statements
In large tables table locks is much useful than row locks but there are some pitfalls:
• If we are using table locking then many threads can read from a table at the same time
but if any threads wish to write in a table then it have to get the exclusive access. And
during the update if other threads wish to access this table then they have to wait until
the update is complete.
• Table updates have the higher priority than the table retrievals.
• Table locks faces some problem in some cases such as when any thread is in waiting
condition because the disk is full and its needs some free space then it can be proceed.
In this situation, all threads, which want to access the problem table, are also in
waiting condition until they get the free space.
Disadvantages of Table locking is given below:
• A client fires a SELECT Statement, which takes a long time to run and at the same
time another client fires an UPDATE statement on the same table. Then this client has
to wait until the SELECT statement is finished.
• If another client fires another SELECT statement on the same table then this SELECT
has to wait until the UPDATE statement is finished because UPDATE has higher
priority than SELECT.
In the following section we are describing you some ways for avoiding the contention
caused by table locking:
• Start mysql with low priority updates. This statement is used to give, all statement
which update the table , lower priority than SELECT statement.
• By using the SET LOW_PRIORITY_UPDATES=1 statement, we can define the all
updates that fired in a defined connection can be done with low priority.
• We can give a specific DML Statements (INSERT, DELETE, UPDATE) lower
priority with LOW_PRIORITY attribute. And we can also give the higher priority to
SELECT statement with the HIGH_PRIORITY attribute.
• If you are facing problem with combination of INSERT and SELECT statement then
you can switch to MyISAM tables because that supports the concurrent SELECT and
INSERT statements.
• If you are using the combination of INSERT and DELETES statement on the same
table then INSERT DELAYED can be helpful to you.
• If you are facing problem with combination of SELECT and DELETE statement then
LIMIT option to DELETE can be help to you.
• Using SQL_BUFFER_RESULT with SELECT statements may be helpful to make
the shorter duration of table locks
External Locking
External locking is the used of filesystem locking for managing the contention to databases
tables by multiple processes. External locking is performed when server and other programs
lock the table files for coordinating among themselves which program may access the tables
at which time.
This type of locking affects the performance of the server because many times before
accessing the tables server must wait for other processes. There is no need of External
locking if you are running a single server for accessing a given database directory and other
programs are not available like myisamchk require to modify the tables while the server is
running. External locking is also not required when you only read the tables with other
programs.
For mysqld, the system variable skip_external_locking value is used to control the external
locking. If this system variable is enabled then external locking is disabled and vice versa.
We can also control the use of external locking by –external-locking or –skip-external-
locking option at server startup.