QAN Stored metrics¶
Stored metrics captures queries after they complete, so you can review historical performance, find slow queries, and track optimization progress over time.
Supported databases¶
Stored metrics supports MySQL, MongoDB, and PostgreSQL with the following requirements:
- MySQL 5.1 or later (if using the slow query log)
- MySQL 5.6.9 or later (if using Performance Schema)
- Percona Server 5.6+ (all Performance Schema and slow log features)
- MariaDB 5.2+ (for user statistics), 10.0+ (for Performance Schema)
Some limitations and tuning options apply when using MySQL’s Performance Schema. See Query Analytics with MySQL.
- PostgreSQL 11 or later
pg_stat_monitorextension (recommended) orpg_stat_statementsextension- Appropriate
shared_preload_librariesconfiguration - Superuser privileges for PMM monitoring account
- MongoDB 6.0 or later (4.4+ may work with limited features)
Profiler requirements
- Profiling enabled for Query Analytics
- Appropriate user roles:
clusterMonitor,read(local), and custom monitoring roles - For MongoDB 8.0+: Additional
directShardOperationsrole required for sharded clusters
Mongolog requirements
- MongoDB configured to log slow operations to a file
- MongoDB server has write permissions to the log directory and file
- PMM agent has read permissions to the MongoDB log file
- Appropriate user roles:
clusterMonitor, or custom monitoring roles (getCmdLineOptsprivilege on{ cluster: true })
Dashboard layout¶
The Stored metrics view contains three panels:
- Filters panel: narrow results by database, service, or query type
- Overview panel: see query metrics and trends
- Details panel: examine individual query performance
Data collection¶
Stored metrics collects data once per minute. When collection delays occur, gaps may appear in the sparkline.
Monitor PMM Server’s internal PostgreSQL¶
By default, Query Analytics hides queries from PMM Server’s internal PostgreSQL database. This keeps the focus on your monitored databases.
Enable this when you need to troubleshoot PMM Server performance, check resource usage, or ensure applications are not accidentally using the default postgres database. This is particularly useful in High Availability (HA) deployments.
To enable:
- Go to PMM Configuration > Settings > Advanced Settings.
- Switch on the QAN for PMM Server option.
- Open Query Analytics and filter by
pmm-server-postgresqlto view queries.
When enabled, you’ll see queries related to PMM’s internal operations—inventory, settings, advisor checks, alerts, backups, and authentication. These are usually lightweight, but unusual spikes may indicate performance issues.
Warning
Do not use PMM Server’s PostgreSQL database for application workloads. Use dedicated databases for your applications.