doc:appunti:linux:sa:mysql
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:linux:sa:mysql [2026/04/24 15:19] – [Restore selettivo di un database] niccolo | doc:appunti:linux:sa:mysql [2026/09/09 15:29] (current) – [Debug query MySQL] niccolo | ||
|---|---|---|---|
| Line 443: | Line 443: | ||
| Ovviamente i dati contenuti nella tabella sono persi, ma dovrebbe essere possibile ricostruire la struttura dal file **frm**. Nella pagina **[[https:// | Ovviamente i dati contenuti nella tabella sono persi, ma dovrebbe essere possibile ricostruire la struttura dal file **frm**. Nella pagina **[[https:// | ||
| + | |||
| + | ===== Debug query MySQL ===== | ||
| + | |||
| + | È possibile avere l' | ||
| + | |||
| + | <code sql> | ||
| + | SHOW FULL PROCESSLIST\G | ||
| + | </ | ||
| + | |||
| + | In particolare è utile esaminare i processi di tipo **Query** e che hanno **Time** (secondi di running time) elevati: | ||
| + | |||
| + | < | ||
| + | ... | ||
| + | Command: Query | ||
| + | Time: 85262 | ||
| + | State: executing | ||
| + | Info: ... | ||
| + | </ | ||
| + | |||
| + | Nella riga **Info** è possibile leggere la query eseguita. | ||
| + | |||
| + | Una query più strutturata per vedere lo stesso tipo di informazioni è la seguente: | ||
| + | |||
| + | <code sql> | ||
| + | SELECT ID, USER, HOST, DB, COMMAND, TIME, LEFT(STATE, | ||
| + | FROM information_schema.PROCESSLIST | ||
| + | WHERE COMMAND <> ' | ||
| + | ORDER BY TIME DESC; | ||
| + | </ | ||
| + | |||
| + | Il campo **STATE** e **INFO** sono stati troncati a 30 caratteri per leggibilità, | ||
| + | |||
| + | Un' | ||
| + | |||
| + | <code sql> | ||
| + | SELECT USER, | ||
| + | FROM information_schema.PROCESSLIST | ||
| + | WHERE COMMAND <> ' | ||
| + | GROUP BY USER,HOST | ||
| + | ORDER BY queries DESC; | ||
| + | </ | ||
| + | |||
| + | che restituisce qualcosa del tipo: | ||
| + | |||
| + | < | ||
| + | +-----------------+---------------------+---------+ | ||
| + | | USER | HOST | queries | | ||
| + | +-----------------+---------------------+---------+ | ||
| + | | asterisk | ||
| + | | system user | ||
| + | | system user | connecting host | ||
| + | | event_scheduler | localhost | ||
| + | | root | localhost | ||
| + | | replication | ||
| + | | replication | ||
| + | +-----------------+---------------------+---------+ | ||
| + | </ | ||
| + | |||
doc/appunti/linux/sa/mysql.1777036774.txt.gz · Last modified: by niccolo
