📜 ⬆️ ⬇️

Maatkit

Tired of me looking at the disgrace on the database servers, installed the maatkit package.

Installation:
cd / usr / ports / databases / maatkit /
make install clean

Using:
')
perl /usr/local/bin/mk-query-digest --filter '($event->{user} || "") =~ m/USER/' /var/log/mysql-slow.log - pull queries by user

perl /usr/local/bin/mk-query-digest --filter '($event->{db} || "") =~ m/DB_NAME/' /var/log/mysql-slow.log - pull queries on the database.

perl /usr/local/bin/mk-query-digest --filter '$event->{Lock_time}>0' /var/log/mysql-slow.log - display the tables that are most often located.

perl /usr/local/bin/mk-query-digest --filter '($event->{Tmp_table} || "") eq "Yes"' /var/log/mysql-slow.log - who uses the Tmp_table

perl /usr/local/bin/mk-query-digest --filter '(($event->{Disk_tmp_table} || "") eq "Yes") || (($event->{Tmp_table} || "") eq "Yes")' /var/log/mysql-slow.log
perl /usr/local/bin/mk-query-digest --filter '$event->{Rows_examined}>500000' /var/log/mysql-slow.log - sort by Rows_examined

perl /usr/local/bin/mk-query-digest --group-by db /var/log/mysql-slow.log - Display a list of databases with statistical information.

Useful links:
http://code.google.com/p/maatkit/wiki/EventAttributes

Source: https://habr.com/ru/post/74211/


All Articles