Hi! 👋 We are doing a big documentation refresh. Help us improve — what's missing or could be better? Let us know! Simply send an email or start a conversation in Google Groups!

These tables cover general-purpose statistics that aren’t specific to MySQL, PostgreSQL, or ProxySQL Cluster. They provide a compatibility shim for client libraries and a view into ProxySQL’s internal memory usage across its core subsystems.

global_variables

Table stats.global_variables exists only to facilitate connections from libraries that issue SELECT @@max_allowed_packet or similar. Its content can be ignored.

FieldTypeDescription
variable_nameVARCHARName of the global variable
variable_valueVARCHARCurrent value of the variable
CREATE TABLE global_variables (
    Variable_Name VARCHAR NOT NULL PRIMARY KEY,
    Variable_Value VARCHAR NOT NULL
)

Example output:

Admin> SELECT * FROM stats.global_variables;
+--------------------------+----------------+
| variable_name            | variable_value |
+--------------------------+----------------+
| mysql-max_allowed_packet | 4194304        |
+--------------------------+----------------+
1 row in set (0.00 sec)

Related tables: global_variables in the Global Variables reference

stats_memory_metrics

This table displays memory usage of various structures inside ProxySQL. Currently, only a few structures are tracked: SQLite, Auth module, Query Digests. But in the future more internal structures will be tracked. The most important values to monitor are the ones related to jemalloc (the memory allocator built inside ProxySQL).

FieldTypeDescription
Variable_NameVARCHARName of the memory metric
Variable_ValueVARCHARCurrent value of the metric
CREATE TABLE stats_memory_metrics (
    Variable_Name VARCHAR NOT NULL PRIMARY KEY,
    Variable_Value VARCHAR NOT NULL
)

A detailed description of the jemalloc values is available at the jemalloc website. Jemalloc metrics:

  • jemalloc_allocated: bytes allocated by the application
  • jemalloc_active: bytes in pages allocated by the application
  • jemalloc_mapped: bytes in extents mapped by the allocator
  • jemalloc_metadata: bytes dedicated to metadata
  • jemalloc_resident: bytes in physically resident data pages mapped by the allocator
  • jemalloc_retained: bytes in virtual memory mappings that were retained for future reuse

Other memory metrics:

  • Auth_memory: memory used by the authentication module to store user credentials and attributes
  • SQLite3_memory_bytes: memory used by the embedded SQLite
  • query_digest_memory: memory used to store data related to stats_mysql_query_digest
  • mysql_query_rules_memory: memory used by query rules
  • mysql_firewall_users_table: memory used for the lookup table of firewall users
  • mysql_firewall_users_config: memory used for configuration of firewall users
  • mysql_firewall_rules_table: memory used for the lookup table of firewall rules
  • mysql_firewall_rules_config: memory used for configuration of firewall rules
  • stack_memory_mysql_threads: memory of MySQL worker threads * stack size
  • stack_memory_admin_threads: memory of admin connections * stack size
  • stack_memory_cluster_threads: memory of ProxySQL Cluster threads * stack size

Note: stack size is 8MB by default

Example output:

Admin> SELECT * FROM stats.stats_memory_metrics;
+------------------------------+----------------+
| Variable_Name                | Variable_Value |
+------------------------------+----------------+
| SQLite3_memory_bytes         | 3002992        |
| jemalloc_resident            | 10342400       |
| jemalloc_active              | 8142848        |
| jemalloc_allocated           | 7124360        |
| jemalloc_mapped              | 39845888       |
| jemalloc_metadata            | 2459072        |
| jemalloc_retained            | 0              |
| Auth_memory                  | 690            |
| query_digest_memory          | 0              |
| mysql_query_rules_memory     | 1380           |
| mysql_firewall_users_table   | 0              |
| mysql_firewall_users_config  | 0              |
| mysql_firewall_rules_table   | 0              |
| mysql_firewall_rules_config  | 329            |
| stack_memory_mysql_threads   | 8388608        |
| stack_memory_admin_threads   | 8388608        |
| stack_memory_cluster_threads | 0              |
+------------------------------+----------------+
17 rows in set (0.01 sec)

Related tables: stats_mysql_query_digest