docs/functions/databases.md
Database query functions provide deep visibility into SQL and NoSQL database performance through Netdata's Live tab. They help you identify problematic queries, detect deadlocks, and understand error patterns—all from the Netdata dashboard.
| Capability | Description |
|---|---|
| Top Queries | Identify the most expensive queries by execution time, I/O, rows processed, or other metrics |
| Running Queries | See currently executing queries in real-time |
| Deadlock Detection | View the latest detected deadlock with full transaction details |
| Error Attribution | Correlate SQL errors with the queries that caused them |
| Database | Top Queries | Running Queries | Deadlock Info | Error Info | Integration Docs |
|---|---|---|---|---|---|
| ClickHouse | ✅ | - | - | - | ClickHouse |
| CockroachDB | ✅ | ✅ | - | - | CockroachDB |
| Couchbase | ✅ | - | - | - | Couchbase |
| Elasticsearch | ✅ | - | - | - | Elasticsearch |
| MongoDB | ✅ | - | - | - | MongoDB |
| Microsoft SQL Server | ✅ | - | ✅ | ✅* | MSSQL |
| MySQL | ✅ | - | ✅ | ✅* | MySQL |
| MariaDB | ✅ | - | ✅ | ✅* | MariaDB |
| Percona Server | ✅ | - | ✅ | ✅* | Percona |
| Oracle Database | ✅ | ✅ | - | - | Oracle |
| PostgreSQL | ✅ | ✅ | - | ✅** | PostgreSQL |
| ProxySQL | ✅ | - | - | - | ProxySQL |
| Redis | ✅ | - | - | - | Redis |
| RethinkDB | - | ✅ | - | - | RethinkDB |
| YugabyteDB | ✅ | ✅ | - | - | YugabyteDB |
* Error Info is integrated directly into Top Queries results—each query row shows its associated errors.
** PostgreSQL error info requires pg_stat_monitor (Percona). The collector auto-detects and uses it when available.
Retrieves accumulated query statistics over a time window. These are aggregated metrics (total calls, total time, average time, etc.) from the database's query statistics infrastructure—not real-time snapshots.
Filter options vary by database but typically include:
The number of queries returned is configurable (default: 500). This is a two-stage process:
Shows currently executing queries at the moment of request. Essential for diagnosing stuck queries, long-running transactions, or unexpected load.
Supported: CockroachDB, Oracle, PostgreSQL, RethinkDB, YugabyteDB
Displays the most recently detected deadlock—not a historical list. When a new deadlock occurs, it replaces the previous one.
Supported: MySQL/MariaDB/Percona, Microsoft SQL Server
Information provided:
Shows recent SQL errors from the database's error history. Error attribution is embedded directly in Top Queries results—each query row includes error details when available.
Supported: MySQL/MariaDB/Percona, Microsoft SQL Server, PostgreSQL (with pg_stat_monitor)
Attribution status values:
enabled — Error details available for this queryno_data — No recent errors for this querynot_enabled — Error tracking not configurednot_supported — Database version lacks required featuresSome databases normalize queries (replacing literals with placeholders), while others show actual values that may contain sensitive data:
| Database | Query Text |
|---|---|
| ClickHouse | Normalized |
| CockroachDB | ⚠️ Raw |
| Couchbase | ⚠️ Raw |
| Elasticsearch | ⚠️ Raw |
| MongoDB | ⚠️ Raw |
| Microsoft SQL Server | ⚠️ Raw |
| MySQL/MariaDB/Percona | Normalized (Top Queries), ⚠️ Raw (Deadlock) |
| Oracle | ⚠️ Raw |
| PostgreSQL | Normalized |
| ProxySQL | Normalized |
| Redis | ⚠️ Raw |
| RethinkDB | ⚠️ Raw |
| YugabyteDB | ⚠️ Raw |
Legend:
SELECT * FROM users WHERE id = ?)SELECT * FROM users WHERE id = 12345):::caution
Error messages may contain sensitive values regardless of query normalization. Ensure appropriate access controls are in place.
:::
Each database requires specific setup. Click the integration link in the table above for: