---
title: Analyze database and instance-level performance issues
source: https://docs.newrelic.com/docs/apm/apm-ui-pages/features/analyze-database-instance-level-performance-issues
---

When you are part of a development, operations, or devops team, database issues need to be investigated quickly. To resolve performance problems and errors with a slow or failing app, you need to be able to analyze whether the underlying cause is related to database performance, one or more hosts or services, or both.

Using APM's [transaction traces](https://docs.newrelic.com/docs/apm/transactions/transaction-traces/transaction-traces), [slow query traces](https://docs.newrelic.com/docs/apm/applications-menu/monitoring/viewing-slow-query-details), and [service maps](https://docs.newrelic.com/docs/data-analysis/service-maps/get-started/service-maps-visualize-monitor-apps-entire-architecture), you can examine the specific query, database instance (host and port), and database name for the problem. APM's instance-level metrics can help you drill down to the specific instance or instances that are involved. This helps you quickly assess the impact and resolve the issue.

![APM Databases slow query details: Database and instances information](https://docs.newrelic.com/images/apm_screenshot-full_database-overview.webp "APM Databases slow query details: Database and instances information")

## Compatibility and requirements [#compatibility]

New Relic collects instance details for a variety of databases and database drivers. The ability to view specific instances and the types of database information in APM depends on your database driver and agent version:

-   **Go:** See [Go agent instance-level compatibility](https://docs.newrelic.com/docs/agents/go-agent/get-started/go-agent-compatibility-requirements#datastores) for datastores.
-   **Java:** See [Java agent instance-level compatibility](https://docs.newrelic.com/docs/agents/java-agent/getting-started/compatibility-requirements-java-agent#instance-level-db) for databases.
-   **.NET:** See [.NET agent instance-level compatibility](https://docs.newrelic.com/docs/agents/net-agent/getting-started/compatibility-requirements-net-agent#instance-details) for datastores.
-   **Node.js:** See [Node.js agent instance-level compatibility](https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/compatibility-requirements-nodejs-agent#instance-details) for datastores.
-   **PHP:** See [PHP agent instance-level compatibility](https://docs.newrelic.com/docs/agents/php-agent/getting-started/php-agent-compatibility-requirements#instance-details) for databases.
-   **Python:** See [Python agent instance-level compatibility](https://docs.newrelic.com/docs/agents/python-agent/getting-started/instrumented-python-packages#instance-details) for databases and packages.
-   **Ruby:** See [Ruby agent instance-level compatibility](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks#instance_details) for ORMs and gems.

To request instance-level information from datastores currently not listed for your agent, get support at [support.newrelic.com](https://support.newrelic.com).

## Use datastore instance details to monitor and troubleshoot your app [#workflow-examples]

Use these examples as starting points to monitor and troubleshoot the performance of connections between your applications and associated datastore instances. The examples describe the New Relic capabilities that can help you determine whether the underlying cause behind app performance problems relates to your applications, a database instance configuration problem (such as a missing index), your organizations resources, or a combination.

**Slow query trace details example**

Your [Apdex](https://docs.newrelic.com/docs/apm/new-relic-apm/apdex/view-your-apdex-score) is falling, and you want to determine what is affecting your end users' experience with your app. On the APM [Database](https://docs.newrelic.com/docs/apm/applications-menu/monitoring/databases-slow-queries-page) page, you notice some slow queries, and you want to investigate further with your database vendor tools.

To do this, you need to know the database name and the instance where the slow query occurred, since the issue may be specific to the instance. For example, the problem may be a missing index. Use APM's [slow query traces](https://docs.newrelic.com/docs/apm/applications-menu/monitoring/viewing-slow-query-details) to review query performance, locate the database name and instance, and identify any poorly written or inefficient queries.

**Transaction trace details example**

Your app has a performance issue, and you have used the APM [Transactions](https://docs.newrelic.com/docs/apm/applications-menu/monitoring/transactions-page) page to identify a suspect transaction. When you select a [transaction trace](https://docs.newrelic.com/docs/apm/transactions/transaction-traces/transaction-traces-trace-details-page) for the slow transaction, you notice that the database time is the key contributor to the transaction performance.

From the selected [transaction trace **Details**](https://docs.newrelic.com/docs/apm/transactions/transaction-traces/transaction-traces-trace-details-page), you select the **Database** 
icon to review the **Database query** information. This shows both the query details and the specific instance where the query was executed. From here you can use your database vendor tools to further diagnose the issue.

![APM transaction trace: Database and instances information](https://docs.newrelic.com/images/apm_screenshot-full_transaction-trace-database-icon-drilldown.webp "APM transaction trace: Database and instances information")

**[one.newrelic.com > All capabilities](https://one.newrelic.com/all-capabilities) > APM & services > (select an app) > Monitor > Databases > (select a trace) > Trace details:** To view information about a specific database and instance that may be contributing to an app's performance problem, select the **Database** icon.

**Query builder example**

If you are using a APM agent that [supports database instance details](#compatibility), you can use [query builder](https://docs.newrelic.com/docs/query-your-data/explore-query-data/query-builder/introduction-query-builder) to report on metrics, such as response time and throughput.

**Alerting on custom metrics for instance performance example**

To be notified about a performance issue between your app and a database instance before it adversely impacts your customers' experience, use [alerts](https://docs.newrelic.com/docs/alerts/new-relic-alerts/getting-started/welcome-new-relic-alerts). You can create [alert policies](https://docs.newrelic.com/docs/alerts/new-relic-alerts/configuring-alert-policies/alert-policy-workflow) that automatically [notify appropriate personnel](https://docs.newrelic.com/docs/alerts/new-relic-alerts/managing-notification-channels/notification-channels-controlling-where-send-alerts) via PagerDuty, webhooks, etc. when problems escalate to the **Critical** thresholds you define.

As part of the alert policy configuration, create a condition with [custom metrics](https://docs.newrelic.com/docs/alerts/new-relic-alerts/configuring-alert-policies/define-custom-metrics-alert-condition) for a specific instance, using this format:

````
Datastore/instance/vendor/host/port
```

For example:

```
Datastore/instance/MySQL/msql-agent-1/12345
```

````
