Вопрос

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