> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_free_lock.md).

# IS\_FREE\_LOCK

## Syntax

```bnf
IS_FREE_LOCK(str)
```

## Description

Checks whether the lock named `str` is free to use (that is, not locked). Returns `1` if the lock is free (no one is using the lock),`0` if the lock is in use, and `NULL` if an error occurs (such as an incorrect argument, like an empty string or `NULL`). `str` is case insensitive.

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

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

## See Also

* [GET\_LOCK](/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/get_lock.md)
* [RELEASE\_LOCK](/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/release_lock.md)
* [IS\_USED\_LOCK](/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_used_lock.md)
* [RELEASE\_ALL\_LOCKS](/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/release_all_locks.md)

<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" %}
