There is no slow query, Ram allocated to MySQL is also low as you can see in the query, no MEMORY engine is used still the RAM consumed by MySQL is 50% of total RAM. How ? & how can we identified where does all RAM goes ?
mysql> system free -h
total used free shared buff/cache available
Mem: 15Gi 9.4Gi 4.0Gi 23Mi 2.3Gi 5.9Gi
Swap: 8.0Gi 123Mi 7.9Gi
mysql> select distinct engine , group_concat(distinct table_schema) from information_schema.tables group by engine ;
+--------------------+---------------------------------------------------------------------------------------------------+
| engine | group_concat(distinct table_schema) |
+--------------------+---------------------------------------------------------------------------------------------------+
| NULL | sys |
| CSV | mysql |
| InnoDB | clicrdv_authent_preprod,clicrdv_default_preprod,clicrdv_sncf_preprod,information_schema,mysql,sys |
| MEMORY | information_schema |
| MyISAM | mysql |
| PERFORMANCE_SCHEMA | performance_schema |
+--------------------+---------------------------------------------------------------------------------------------------+
6 rows in set (0.02 sec)
mysql> SELECT ( @@key_buffer_size + @@query_cache_size + @@innodb_buffer_pool_size + @@innodb_log_buffer_size + @@tmp_table_size + @@max_heap_table_size + @@max_connections * ( @@sort_buffer_size + @@read_buffer_size + @@read_rnd_buffer_size + @@join_buffer_size + @@thread_stack + @@binlog_cache_size ) ) / (1024 *
1024 * 1024) AS MAX_MEMORY_GB;
+---------------+
| MAX_MEMORY_GB |
+---------------+
| 0.3512 |
+---------------+
1 row in set, 1 warning (0.00 sec)
# Time: 2024-09-27T12:52:37.480347Z
# User@Host: prometheus_mysql_exporter[prometheus_mysql_exporter] @ [172.18.29.12] Id: 12573
# Query_time: 145.464411 Lock_time: 0.051933 Rows_sent: 253 Rows_examined: 6238
SET timestamp=1727441557;
SELECT table_schema, table_name, column_name, auto_increment,
pow(2, case data_type
when 'tinyint' then 7
when 'smallint' then 15
when 'mediumint' then 23
when 'int' then 31
when 'bigint' then 63
end+(column_type like '% unsigned'))-1 as max_int
FROM information_schema.tables t
JOIN information_schema.columns c USING (table_schema,table_name)
WHERE c.extra = 'auto_increment' AND t.auto_increment IS NOT NULL;
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
/usr/sbin/mysqld, Version: 5.7.42-log (MySQL Community Server (GPL)). started with:
Tcp port: 0 Unix socket: /var/r
root@slcmysql101:~# ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
PID PPID CMD %MEM %CPU
121926 1 /usr/sbin/mysqld --daemoniz 53.7 0.5
1054 899 s1-agent 1.0 0.1
1053 899 s1-scanner 0.7 0.0
649 1 /usr/share/filebeat/bin/fil 0.2 0.0
1051 899 s1-network 0.2 0.0
322 1 /lib/systemd/systemd-journa 0.1 0.0
34820 1 /lib/systemd/systemd --user 0.0 0.0
34817 661 sshd: admclara [priv] 0.0 0.0
36110 661 sshd: admclara [priv] 0.0 0.0
root@slcmysql101:~#