Quick verdict
Choose Prometheus (with exporters, Grafana and Alertmanager) if you already run Prometheus for your infrastructure, want no licence cost and full control of the data, and have people to operate the stack. Its strength is server-level metrics and alerting; per-query analysis is limited to what the exporters expose. Choose Datadog Database Monitoring if you want query-level insight (normalised queries, samples, explain plans) linked to application traces, without running the monitoring system yourself, and can accept per-host pricing on a SaaS platform.
Prometheus describes itself as an open source systems monitoring and alerting toolkit, originally built at SoundCloud. It stores metrics as time series identified by a name and key-value labels, collects them through a pull model over HTTP, and is queried with PromQL. It joined the Cloud Native Computing Foundation in 2016 as its second hosted project, and all components are under the Apache 2 licence. The latest release on GitHub is 3.15.0 (September 2026). Prometheus does not connect to databases itself: an exporter queries the database and publishes metrics on an HTTP endpoint that Prometheus scrapes. Dashboards usually come from Grafana (AGPL-3.0-only) and notifications from Alertmanager.
Datadog is a commercial SaaS observability platform. Its Database Monitoring (DBM) product requires the Datadog Agent and documents support for self-hosted and managed Postgres, MySQL, MariaDB, Oracle, SQL Server, MongoDB, Amazon DocumentDB and ClickHouse. It collects query metrics for normalised queries, individual query samples and explain plans, alongside database-level metrics, and can be linked to Datadog APM traces. It is billed per database host.
Side by side
| Aspect | Prometheus | Datadog |
|---|---|---|
| Licence and cost | Free, Apache 2 (Grafana is AGPL-3.0-only); you pay for servers and staff time | Paid SaaS; DBM billed per database host per month |
| Deployment | Self-hosted: Prometheus server, exporters, Grafana, Alertmanager | Datadog Agent on your hosts or alongside managed databases; data stored by Datadog |
| Database coverage | Per exporter: postgres_exporter, mysqld_exporter, sql_exporter (SQL Server and others) | Postgres, MySQL, MariaDB, Oracle, SQL Server, MongoDB, Amazon DocumentDB, ClickHouse |
| What is collected | Numeric server metrics (connections, transactions, cache, replication, locks); optional top-statement metrics | Database metrics plus normalised query metrics, query samples and explain plans |
| Explain plans | Not collected by the standard exporters | Collected (Postgres needs a datadog.explain_statement() function in each database) |
| Retention | Local storage defaults to 15 days; longer needs remote write to another store | Infrastructure metrics kept 15 months on Pro and Enterprise plans |
| Alerting | PromQL alerting rules in Prometheus, routed by Alertmanager | Datadog monitors and notifications in the platform |
| Trace correlation | Not built in; needs a separate tracing system | DBM and APM linked by injecting trace identifiers as SQL comments |
| Main trade-off | No licence cost and full control, but you build and run the stack and get little query-level detail | Query-level depth with nothing to host, but cost grows with database hosts and data leaves your network |
Key differences
Metrics toolkit versus database monitoring product
The main difference is scope. Prometheus is a general metrics system: it knows nothing about databases until you deploy an exporter, and what you see is whatever that exporter turns into numbers. The Prometheus-community postgres_exporter (Apache-2.0, CI-tested against PostgreSQL 13 to 18, default port 9187) publishes series such as pg_stat_database_xact_commit, pg_stat_database_deadlocks and replication and activity metrics; it recommends a monitoring user granted the pg_monitor role. The mysqld_exporter, maintained under the Prometheus organisation (Apache-2.0, MySQL 5.6 and later, MariaDB 10.3 and later, default port 9104), exposes mysql_up, mysql_global_status_* and optional Performance Schema collectors, and needs the PROCESS and REPLICATION CLIENT grants plus SELECT.
For SQL Server there is no exporter under the Prometheus organisation. The common route is sql_exporter, a permanent fork of the original database-agnostic SQL exporter, maintained by burningalchemist under the MIT licence (default port 9399). Its metrics are entirely defined by YAML collector files of SQL queries, and it supports SQL Server, MySQL, PostgreSQL, Oracle, ClickHouse, Snowflake and Vertica. Grafana's Alloy collector ships a prometheus.exporter.mssql component that embeds sql_exporter with a default set of SQL Server queries (connections, deadlocks, batch requests, page life expectancy, memory and I/O stalls).
Datadog DBM, by contrast, is built for databases: it collects query metrics for normalised queries, samples of individual executions and explain plans, and lets you filter by team, service, host or cluster. That is the layer most teams want when asking "which query got slower", and it is the layer a plain Prometheus setup mostly lacks.
Query-level detail
Both build on the database's own statistics. On PostgreSQL that means pg_stat_statements: Datadog documents it as required for its postgresql.queries.* metrics, and postgres_exporter has a stat_statements collector that is disabled by default and limited by default to the top 100 statements with query text cut to 120 characters. On MySQL, mysqld_exporter can read Performance Schema statement summaries. In Prometheus these become extra time series per statement, which raises label cardinality, so they are normally capped. Prometheus's own overview notes that it is not a good choice where you need every event recorded in full. Datadog stores query samples and explain plans as records rather than metric series, which suits drilling into a single slow execution.
What running it yourself involves
A Prometheus stack is several components you deploy, upgrade and secure: the Prometheus server, one exporter per database (or a multi-target exporter), Grafana, and Alertmanager. Prometheus's documentation states that local storage is not clustered or replicated and should be managed like any single-node database, and retention defaults to 15 days unless configured. Longer history or high availability usually means remote write to a separate long-term store. A minimal scrape configuration for one postgres_exporter looks like this (Prometheus YAML; scrape_interval defaults to 1m and metrics_path to /metrics):
# prometheus.yml (Prometheus configuration)
scrape_configs:
- job_name: "postgres"
scrape_interval: 30s
static_configs:
- targets: ["pg-exporter.internal:9187"]
labels:
env: "prod"Both postgres_exporter and mysqld_exporter also support a multi-target pattern, in which one exporter serves several database servers through a /probe?target=... endpoint and Prometheus relabels each target into the request. A PromQL query for commits per second by database over five minutes, and a simple expression you could use in an alerting rule:
# PromQL: transactions committed per second, per database
sum by (datname) (rate(pg_stat_database_xact_commit[5m]))
# PromQL: MySQL exporter cannot reach its server (use in an alerting rule)
mysql_up == 0Alerting rules are evaluated in Prometheus, which sends firing alerts to Alertmanager; Alertmanager handles silencing, inhibition, aggregation and delivery to email, on-call and chat systems. With Datadog, the Agent and the backend are run for you; on PostgreSQL you still create a monitoring user (Datadog also uses pg_monitor), enable pg_stat_statements and, for explain plans, create the documented function in each database. Datadog lists Agent 7.36.1 or later as the minimum for self-hosted Postgres DBM.
Linking database load to applications
Datadog documents a DBM and APM connection that injects trace identifiers into queries as SQL comments, in a "service" mode (service name only) or "full" mode (full trace context), for Postgres, MySQL, SQL Server, Oracle and MongoDB. You can then move from a slow trace span to the query sample and explain plan, or see which services drive a database's load. A Prometheus setup has no equivalent on its own; you would add a separate tracing system and correlate by time and labels. The difference between these two views is explained in Database Monitoring vs APM.
Combining them
The two are not mutually exclusive. The Datadog Agent can scrape Prometheus and OpenMetrics endpoints, so existing exporters can feed Datadog, but Datadog's documentation states that all metrics retrieved this way count as custom metrics, which are billed beyond each plan's allowance. Teams sometimes keep Prometheus for broad infrastructure metrics and add Datadog DBM only for the databases where query-level detail justifies the per-host cost.
Pricing and licensing
Prometheus, its exporters and Alertmanager are free open source software (Apache 2; sql_exporter is MIT). Grafana's open source edition is free under AGPL-3.0-only. The real costs are the servers and storage you run, any long-term storage behind remote write, and the time to build dashboards and rules and keep the stack upgraded. Managed Prometheus-compatible services also exist, with their own pricing.
Datadog Database Monitoring was listed on the vendor's pricing page in October 2026 at USD 70 per database host per month billed annually, or USD 84 per database host per month billed month-to-month or on demand. Infrastructure Monitoring is priced separately (Pro listed at USD 15 per host per month billed annually; Enterprise USD 23), and Datadog's free infrastructure tier covers up to 5 hosts with 1-day metric retention. Metrics scraped from Prometheus endpoints count as custom metrics. Check the current pricing page and your contract, as discounts and allotments vary.
Pricing checked on the vendors' official pages on 7 October 2026. Prices change; confirm before buying.
Where each one leads
Prometheus strengths
- No licence cost; Apache 2 server, exporters and Alertmanager
- Data stays on your own infrastructure
- PromQL and alerting rules are flexible and version-controllable as text files
- Exporters cover PostgreSQL, MySQL and MariaDB, and SQL Server through sql_exporter
- Same stack can monitor the rest of your infrastructure and Kubernetes
Datadog strengths
- Normalised query metrics, query samples and explain plans out of the box
- Broad engine support, including managed cloud databases, Oracle, MongoDB and ClickHouse
- Links slow traces to the queries behind them through DBM and APM correlation
- Nothing to host; 15-month metric retention on paid infrastructure plans
- Can also ingest existing Prometheus exporter metrics
Limitations
Prometheus limitations
- You deploy, secure, upgrade and scale every component yourself
- Local storage is single-node, 15 days by default; long-term history needs remote write
- Standard exporters do not collect query samples or explain plans
- Per-query metrics add high-cardinality series and are capped
- No SQL Server exporter under the Prometheus organisation; SQL Server needs hand-written or community query collectors
Datadog limitations
- Per database host pricing on top of other Datadog products
- Prometheus metrics ingested into Datadog are billed as custom metrics
- Monitoring data, including query text and samples, is stored by a third party
- Setup still needs database users, extensions and, for Postgres explain plans, a function in each database
When to choose each
Choose Prometheus if
- You already run Prometheus and Grafana for infrastructure and want databases in the same place
- Budget rules out per-host SaaS pricing, but you have engineers to operate the stack
- Monitoring data must stay inside your network
- Server-level health and alerting matter more than per-query analysis
Choose Datadog if
- You need to find which queries got slower, with samples and explain plans
- You already use Datadog for infrastructure or APM
- You run several engines, including managed cloud databases, Oracle or MongoDB
- You would rather pay for a service than run a monitoring stack
When neither is right
- You mainly run SQL Server and want a DBA-focused monitor with wait and blocking analysis: see Redgate Monitor vs SQL Sentry and Datadog vs SolarWinds DPA.
- You want a SaaS observability platform priced by data ingested rather than by host: see Datadog vs New Relic.
- You need occasional PostgreSQL query analysis rather than continuous monitoring:
pg_stat_statementsplus a log analyser may be enough; see pgAdmin vs pgBadger. - You want an open source, database-focused stack with query analytics built in: compare the options in open source database monitoring tools.
Final recommendation
Prometheus is the stronger choice for teams that already operate it, want free software and control of their data, and mainly need server metrics and alerting; plan for exporters, Grafana, Alertmanager and long-term storage. Datadog Database Monitoring is the stronger choice when query-level diagnosis and trace correlation matter and paying per database host is acceptable. Many teams use both: Prometheus for broad metrics, Datadog DBM for the databases that need deeper analysis.
Frequently asked questions
Can Prometheus monitor SQL Server?
Yes, through an exporter. The usual option is sql_exporter (MIT, maintained by burningalchemist), which runs SQL queries you define in YAML collector files and exposes the results as metrics. Grafana Alloy includes a prometheus.exporter.mssql component that embeds sql_exporter with default SQL Server queries. There is no SQL Server exporter under the Prometheus organisation itself.
Does Prometheus show slow queries?
Only in aggregate. postgres_exporter has an optional stat_statements collector (disabled by default, top 100 statements by default) that turns pg_stat_statements into metrics, and mysqld_exporter can read Performance Schema statement summaries. Individual query samples and explain plans are not collected by these exporters.
How long does Prometheus keep data?
15 days by default, unless you set storage.tsdb.retention.time or a size limit. Local storage is not replicated, so long-term or highly available storage usually means remote write to a separate system.
How is Datadog Database Monitoring priced?
Per database host per month. The pricing page listed USD 70 billed annually and USD 84 month-to-month or on demand in October 2026, separate from Infrastructure Monitoring and APM.
Can Datadog use my existing Prometheus exporters?
Yes. The Datadog Agent's OpenMetrics integration scrapes Prometheus-format endpoints, but Datadog counts all metrics collected this way as custom metrics for billing.
Sources
- Prometheus documentation: Overview
- Prometheus documentation: Configuration (scrape_config)
- Prometheus documentation: Storage (retention, remote write)
- Prometheus documentation: Alerting overview (Alertmanager)
- Prometheus releases on GitHub
- postgres_exporter (prometheus-community) on GitHub
- mysqld_exporter (Prometheus) on GitHub
- sql_exporter (burningalchemist) on GitHub
- Grafana Alloy: prometheus.exporter.mssql
- Grafana on GitHub (licence)
- Datadog documentation: Database Monitoring
- Datadog documentation: Setting up DBM for self-hosted Postgres
- Datadog documentation: Correlate DBM and APM
- Datadog documentation: OpenMetrics integration
- Datadog pricing list
Checked October 2026.
How we research comparisons: our editorial method.