0

I have a very large sql query. How do I see a list of all the locks that it sets during execution in MySQL/MariaSQL InnoDB?

Florian Mertens
  • 2,418
  • 4
  • 27
  • 37

1 Answers1

0

There are some INFORMATION_SCHEMA tables for this:

In general, you can't get a list of locks, unless there's a lock-wait in progress.

That is, transaction A can hold some number of locks, but unless some transaction B is stuck waiting for it, it doesn't show up in the INFORMATION_SCHEMA.

See also How do I find which transaction is causing a "Waiting for table metadata lock" state?

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828