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.

Était-ce utile?

La 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

Autres conseils

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)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top