2011-08-25 9 views
6

È possibile trovare la query esatta dall'ID query mysql?Trova la query da query_id in mysql

Questa è una parte di "INNODB MOSTRA MOTORE STATO" in MySQL:

MySQL thread id 1106, query id 1360 localhost 127.0.0.1 test2 
---TRANSACTION 0 19491, not started, OS thread id 2960035840 

Esiste un modo attraverso il quale riesco a trovare quello che era la query con id 1360?

risposta

0

appena aggiunto questa linea di my.cnf

log=/tmp/mysql_query.log 

servizio MySQL quindi riavviato (/etc/init.d/mysql stop/etc/init.d/mysql start)

Poi code il file di log. Apparentemente c'è un ID query in esso!

110825 15:07:49 36 Connect ***@localhost on *** 
... 
      36 Query SELECT * FROM genre g LIMIT 0,1000 
      36 Quit 

Vedi anche http://www.jeff-barr.com/?p=112 e http://dev.mysql.com/doc/refman/5.1/en/query-log.html

+0

quale di questi è l'ID della query? –

+0

Credo che "36" sia la query id – bpgergo

+0

Ho immaginato che questo sia il formato 'cat /tmp/mysql_query.log | egrep "^ \ s + ([0-9] +) Query \ s + SELEZIONA" 'Spero che questo aiuti – bpgergo

0

È possibile utilizzare il seguente comando: SHOW PROCESSLIST;

Fornirà tutto il processo attualmente in esecuzione con l'ID della query e la query in esecuzione.