---
title: "Database Monitoring Setup"
description: "Prepare PostgreSQL or MongoDB for Middleware Database Monitoring to see query metrics, samples, explain plans and the services that send each query."
section: "APM"
breadcrumb: "APM > Database Monitoring > Setup"
canonical: "https://docs.middleware.io/get-started/database"
---
# Database Monitoring Setup

Database Monitoring shows what your databases are doing at the query level: which queries run most often, which are slow, what they wait on, and which application services send them. The Middleware Agent collects this data through your database integration, so each database needs a short one-time setup before its queries appear under **APM → Database**.

**New to Database Monitoring? Start with these three.** One setup per database server.

1. **Install the agent** — On a host or Kubernetes cluster that can reach your database
2. **Prepare your database** — Create a monitoring user and turn on the data collection your engine needs
3. **Open APM → Database** — Instances, query metrics and samples appear once traffic flows

## Choose your database

Pick the engine you run. Each guide covers the database-side settings, the monitoring user, and the collection options to turn on in the integration.

### Databases

Supported engines for query-level monitoring.

- [PostgreSQL](/get-started/database/postgresql) — Enable pg_stat_statements, create a monitoring user, and turn on query sample, top query and schema collection.
- [MongoDB](/get-started/database/mongodb) — Create a profiling user and set the profiling level so slow operations appear in Query Metrics and Samples.

### Explore your database data

Once your database is set up, these are the places to go next.

- [**Database Monitoring**](/features/apm/database-monitoring) — Query metrics, samples, explain plans, wait events and schemas.
- [**Install the Agent**](/get-started/agent) — The agent collects database data, so it must be able to reach the database.
- [**Database Integrations**](/integrations) — Connection and TLS options for every supported database integration.

Need assistance or want to learn more about Middleware? Get in touch with us via our Contact Us page or join our Slack channel.
