My question is similar to How to list all prepared statements for all active sessions?, but for MySQL.
I have a program (prosody XMPP server) that seems to be leaking prepared statements. To diagnose the problem, I want a list of all "open" prepared statements. (even prepared statements by 'dead' connections, if such exist)
The statements in question are, as far as I can tell, all created by the MySQL user 'prosody', so I'd like to list all statements created by this user. However, it'd be also nice to have a list of all statements for all users.
I am not fully aware of the prepared statement's lifecycle/possible states, so details in that regard are very welcome.
It turned out to be very simple:
SHOW GLOBAL STATUS LIKE '%prepared_stmt_count%';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With