Skip to content

Instantly share code, notes, and snippets.

@opmat
Forked from utdrmac/mysql_memory_usage.sql
Created November 23, 2023 02:48
Show Gist options
  • Save opmat/044db41cfa65c37d5243039d37f01215 to your computer and use it in GitHub Desktop.
Save opmat/044db41cfa65c37d5243039d37f01215 to your computer and use it in GitHub Desktop.
MySQL Memory Usage
SELECT CONCAT((@@key_buffer_size + @@query_cache_size + (@@innodb_buffer_pool_size * 1.05 + 20*1024*1024) + @@innodb_additional_mem_pool_size + @@innodb_log_buffer_size
+ @@max_connections * (@@read_buffer_size + @@read_rnd_buffer_size + @@sort_buffer_size + @@join_buffer_size + @@binlog_cache_size + @@tmp_table_size
+ @@thread_stack)) / 1024/1024/1024, ' GB') AS "POTENTIAL MEMORY USAGE";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment