Question

How many GET_LOCKS can be handled by a mysql server - by the whole server. I wasn´t able to find anything about its limitations.

Was it helpful?

Solution

As per MySQL documentation GET_LOCK() you cannot hold more than one lock per connection.

As it says

If you have a lock obtained with GET_LOCK(), it is released when you execute RELEASE_LOCK(), execute a new GET_LOCK(), or your connection terminates (either normally or abnormally).

So essentially, it depends on No.Of connection. I would say the equation would

No.of GET_LOCK handled = NO.Of Connections handled

I see there is a bug logged where people suggested to have concurrent lock per connection. See here http://bugs.mysql.com/bug.php?id=1118

OTHER TIPS

mysql> SELECT GET_LOCK('s',10);
+------------------+
| GET_LOCK('s',10) |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)

mysql> SELECT GET_LOCK('t',10);
+------------------+
| GET_LOCK('t',10) |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)

mysql> SELECT GET_LOCK('b',10);
+------------------+
| GET_LOCK('b',10) |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)

mysql> SELECT IS_FREE_LOCK('b');
+-------------------+
| IS_FREE_LOCK('b') |
+-------------------+
|                 0 |
+-------------------+
1 row in set (0.00 sec)

mysql> SELECT IS_FREE_LOCK('t');
+-------------------+
| IS_FREE_LOCK('t') |
+-------------------+
|                 1 |
+-------------------+
1 row in set (0.00 sec)

mysql> SELECT IS_FREE_LOCK('s');
+-------------------+
| IS_FREE_LOCK('s') |
+-------------------+
|                 1 |
+-------------------+
1 row in set (0.00 sec)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top