# IS\_USED\_LOCK

## Syntax

```sql
IS_USED_LOCK(str)
```

## Description

Checks whether the lock named `str` is in use (that is, locked). If so, it returns the connection identifier of the client that holds the lock. Otherwise, it returns `NULL`. `str` is case insensitive.

If the [metadata\_lock\_info](../../../plugins/other-plugins/metadata-lock-info-plugin) plugin is installed, the [Information Schema](../../../system-tables/information-schema) [metadata\_lock\_info](../../../system-tables/information-schema/information-schema-tables/information-schema-metadata_lock_info-table) table contains information about locks of this kind (as well as [metadata locks](../../../sql-statements/transactions/metadata-locking)).

Statements using the `IS_USED_LOCK` function are [not safe for statement-based replication](../../../../ha-and-performance/standard-replication/unsafe-statements-for-statement-based-replication).

## See Also

* [GET\_LOCK](get_lock)
* [RELEASE\_LOCK](release_lock)
* [IS\_FREE\_LOCK](is_free_lock)
* [RELEASE\_ALL\_LOCKS](release_all_locks)

<sub>_This page is licensed: GPLv2, originally from_</sub> [<sub>_fill\_help\_tables.sql_</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}
