Is there a way to check the number of active transactions (on the database, not on the local UniConnection component) at any given time, using MySQL + UniConnection?

I'm trying to avoid deadlocks from extended operations and this way I could make one app wait until there are no ongoing active transactions executing from another app, into the same database.

有帮助吗?

解决方案

You could use the MySQL Command, SHOW OPEN TABLES, to determine if there is a lock on a table. The in_use column provides the number of table locks or lock requests for tables.

In which case, you could simply LOCK TABLES and UNLOCK TABLES around queries that are expected to have a long execution time.

其他提示

You can query the INFORMATION_SCHEMA for transaction related tables, I would refer to the Docs about it at MySQL: Information Schema Tables about Transactions

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top