Difference between revisions of "MariaDB slow queries"

From wikieduonline
Jump to navigation Jump to search
 
(15 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
https://mariadb.com/kb/en/slow-query-log/
  
 
  [[/etc/mysql/mariadb.conf.d/50-server.cnf]]
 
  [[/etc/mysql/mariadb.conf.d/50-server.cnf]]
 
  [[/var/log/mysql/mariadb-slow.log]]
 
  [[/var/log/mysql/mariadb-slow.log]]
 
  [[systemctl restart mariadb]] && [[systemctl status mariadb]]
 
  [[systemctl restart mariadb]] && [[systemctl status mariadb]]
 +
 +
[[/etc/mysql/mariadb.conf.d/50-server.cnf]]
 +
#Enable the slow query log to see queries with especially long duration
 +
slow_query_log_file = [[/var/log/mysql/mariadb-slow.log]]
 +
long_query_time = 10
 +
log_slow_rate_limit = 1000
 +
log_slow_verbosity = query_plan
 +
log-queries-not-using-indexes
 +
 +
 +
[[/usr/lib/nagios/plugins/check_mysql]]
 +
Uptime: 1133648  Threads: 14  Questions: 159793336  Slow queries: 1718223  Opens: 191  Flush tables: 1  Open tables: 184  Queries per second avg: 140.954|Connections=2757900c;;; Open_files=57;;; Open_tables=184;;; Qcache_free_memory=2423328;;; Qcache_hits=38449185c;;; Qcache_inserts=106590640c;;; Qcache_lowmem_prunes=105448285c;;; Qcache_not_cached=342783c;;; Qcache_queries_in_cache=3589;;; Queries=159793336c;;; Questions=159793336c;;; Table_locks_waited=0c;;; Threads_connected=1;;; Threads_running=6;;; Uptime=1133648c;;;
  
 
== Related ==
 
== Related ==
[[pt-query-digest]]
+
* [[AWS RDS query logging]], <code>[[log_statement]]</code> and <code>[[log_min_duration_statement]]</code>
https://mariadb.com/kb/en/slow-query-log/
+
* <code>[[504 Gateway Time-out]]</code>
<code>[[mysqldump]] --single-transaction</code>
+
* <code>[[pt-query-digest]]</code>
 +
* <code>[[mysqldump]] --single-transaction</code>
 +
* [[PostgreSQL]]: [[log_duration]]
 +
* [[mariadb-dumpslow]]
 +
* [[mysqldumpslow]]
 +
* [[systemctl restart php* && systemctl status php*]]
  
 
== See also ==
 
== See also ==

Latest revision as of 09:22, 25 October 2024

https://mariadb.com/kb/en/slow-query-log/

/etc/mysql/mariadb.conf.d/50-server.cnf
/var/log/mysql/mariadb-slow.log
systemctl restart mariadb && systemctl status mariadb
/etc/mysql/mariadb.conf.d/50-server.cnf
#Enable the slow query log to see queries with especially long duration
slow_query_log_file	= /var/log/mysql/mariadb-slow.log
long_query_time = 10
log_slow_rate_limit	= 1000
log_slow_verbosity	= query_plan
log-queries-not-using-indexes


/usr/lib/nagios/plugins/check_mysql
Uptime: 1133648  Threads: 14  Questions: 159793336  Slow queries: 1718223  Opens: 191  Flush tables: 1  Open tables: 184  Queries per second avg: 140.954|Connections=2757900c;;; Open_files=57;;; Open_tables=184;;; Qcache_free_memory=2423328;;; Qcache_hits=38449185c;;; Qcache_inserts=106590640c;;; Qcache_lowmem_prunes=105448285c;;; Qcache_not_cached=342783c;;; Qcache_queries_in_cache=3589;;; Queries=159793336c;;; Questions=159793336c;;; Table_locks_waited=0c;;; Threads_connected=1;;; Threads_running=6;;; Uptime=1133648c;;;

Related[edit]

See also[edit]

Advertising: