Reputation: 14373
Can I find the exact query from mysql query id?
This is a part of "SHOW ENGINE INNODB STATUS"
in MySQL:
MySQL thread id 1106, query id 1360 localhost 127.0.0.1 test2
---TRANSACTION 0 19491, not started, OS thread id 2960035840
Is there a way by which I can find what was the query with id 1360?
Upvotes: 16
Views: 16838
Reputation: 1027
You can use the following command:
SHOW PROCESSLIST;
It will give you all currently running process with their query ID and query that is being executed.
Upvotes: -1
Reputation: 16047
Just added this line to my.cnf
log=/tmp/mysql_query.log
Then restarted mysql service (/etc/init.d/mysql stop
/etc/init.d/mysql start
)
Then tailed the log file. Seemingly there is a query id in it!
110825 15:07:49 36 Connect ***@localhost on ***
...
36 Query SELECT * FROM genre g LIMIT 0,1000
36 Quit
See also http://www.jeff-barr.com/?p=112 and http://dev.mysql.com/doc/refman/5.1/en/query-log.html
Upvotes: -1
Reputation: 16047
Some folks say turn on 'general log' and you'll find your query by id. http://forums.mysql.com/read.php?22,419784,419896#msg-419896
Upvotes: -1