Domanda

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.

È stato utile?

Soluzione

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.

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top