Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

APM Dashboard - Database Offenders

apm
shared-dashboards

#1

Dashboard of the Day: Database Offenders

Motivation

This dashboard shows an overview of which transactions have the slowest database queries. By determining which database queries are running slow, you can quickly determine which transactions are causing bottlenecks in your applications overall performance.


Screenshot


Dashboard Details

Required Products: APM
Level of Effort: Low
This dashboard will work on the standard New Relic data models and does not require any custom attributes or events.

Settings
Use the gear button to edit your dashboard and configure the following settings:

  • Dashboard Filter: Enabled
  • Enabled Event Types: Transaction
  • Enabled Attributes: appName, name

Chart Details

In this section, we’ll go into the details on the purpose of each of the charts you see above. We’ll also show you the query (NRQL) that you can cut/paste into your Insights query bar.

Worst DB Offenders

Facet Table (linked)

SELECT sum(databaseDuration) as 'Time', count(*) as 'Count', percentile(databaseDuration, 99, 80, 50) as 'DB' FROM Transaction FACET name SINCE 1 day ago LIMIT 15

This query separates each database call and details the duration of the call in various percentiles

Accumulated DB Time by Trans.

Linked Bar Chart

SELECT sum(databaseDuration) FROM Transaction FACET name SINCE 1 day ago LIMIT 20

Totals the database durations for each transaction

Max DB Duration

Line Chart

SELECT max(databaseDuration) as 'DB' FROM Transaction FACET name SINCE 1 day ago LIMIT 15 TIMESERIES

Displays the highest database durations

Max DB Duration

Bar Chart_

SELECT max(databaseDuration) as 'DB' FROM Transaction FACET name SINCE 1 day ago LIMIT 15

Displays the maximum recorded database duration over time per transaction name

Worst App offenders

Bar Chart

SELECT sum(duration) as 'App', count(*) as 'Count', percentile(duration, 99, 80, 50) as 'App' FROM Transaction FACET name SINCE 1 day ago LIMIT 5

Provides the top 5 worst database times and details them out by various percentiles

Transaction Time (DB inclusive)

Bar Chart

SELECT sum(duration) FROM Transaction FACET name SINCE 1 day ago LIMIT 7

Displays the sum of all transaction times per transaction for the default time period

Accumulated DB Time by Histogram

Heatmap

SELECT histogram(databaseDuration) FROM Transaction FACET name SINCE 1 day ago LIMIT 20

Displays the database durations in a histogram


Extra Credit - Share your dashboard with the community!

Want to be a super “NeRD” (New Relic Developer)?
Use the API Explorer (or our Postman collection) to load the dashboard definition below into Insights or share the definition of your dashboard and increase your international NeRD cred! (And you’ll earn a cool badge for your community profile!)
Here’s some quick tips on how to do this.

Dashboard Definition

{
  "dashboard": {
    "title": "APM Database Offenders",
    "description": null,
    "icon": "bar-chart",
    "visibility": "all",
    "editable": "editable_by_all",
    "metadata": {
      "version": 1
    },
    "widgets": [
      {
        "visualization": "markdown",
        "layout": {
          "width": 3,
          "height": 1,
          "row": 1,
          "column": 1
        },
        "data": [
          {
            "source": "# Motivation\n---\nThis dashboard shows an overview of which transactions have the slowest database queries. By determining which database queries are running slow, you can quickly determine which transactions are causing bottlenecks in your applications overall performance.\n\nhttps://discuss.newrelic.com/t/apm-dashboard-database-offenders/61049"
          }
        ],
        "presentation": {
          "title": "",
          "notes": null
        }
      },
      {
        "visualization": "facet_table",
        "layout": {
          "width": 2,
          "height": 2,
          "row": 1,
          "column": 1
        },
        "data": [
          {
            "nrql": "SELECT sum(databaseDuration) as 'Time', count(*) as 'Count', percentile(databaseDuration, 99, 80, 50) as 'DB' FROM Transaction FACET name SINCE 1 day ago LIMIT 15"
          }
        ],
        "presentation": {
          "title": "Worst DB offenders",
          "notes": "This query separates each database call and details the duration of the call in various percentiles"
        }
      },
      {
        "visualization": "facet_bar_chart",
        "layout": {
          "width": 1,
          "height": 2,
          "row": 1,
          "column": 3
        },
        "data": [
          {
            "nrql": "SELECT sum(databaseDuration) FROM Transaction FACET name SINCE 1 day ago LIMIT 20"
          }
        ],
        "presentation": {
          "title": "Accumulated DB Time by Trans.",
          "notes": "Totals the database durations for each transaction"
        }
      },
      {
        "visualization": "faceted_line_chart",
        "layout": {
          "width": 1,
          "height": 1,
          "row": 3,
          "column": 1
        },
        "data": [
          {
            "nrql": "SELECT max(databaseDuration) as 'DB' FROM Transaction FACET name SINCE 1 day ago LIMIT 15 TIMESERIES"
          }
        ],
        "presentation": {
          "title": "Max DB Duration",
          "notes": "Displays the maximum recorded database duration per transaction name"
        }
      },
      {
        "visualization": "facet_table",
        "layout": {
          "width": 2,
          "height": 1,
          "row": 3,
          "column": 2
        },
        "data": [
          {
            "nrql": "SELECT max(databaseDuration) as 'DB' FROM Transaction FACET name SINCE 1 day ago LIMIT 15"
          }
        ],
        "presentation": {
          "title": "Max DB Duration",
          "notes": "Displays the maximum recorded database duration over time per transaction name"
        }
      },
      {
        "visualization": "facet_table",
        "layout": {
          "width": 2,
          "height": 1,
          "row": 4,
          "column": 1
        },
        "data": [
          {
            "nrql": "SELECT sum(duration) as 'App', count(*) as 'Count', percentile(duration, 99, 80, 50) as 'App' FROM Transaction FACET name SINCE 1 day ago LIMIT 5"
          }
        ],
        "presentation": {
          "title": "Worst App offenders",
          "notes": "Provides the top 5 worst database times and details them out by various percentiles"
        }
      },
      {
        "visualization": "facet_bar_chart",
        "layout": {
          "width": 1,
          "height": 1,
          "row": 4,
          "column": 3
        },
        "data": [
          {
            "nrql": "SELECT sum(duration) FROM Transaction FACET name SINCE 1 day ago LIMIT 7"
          }
        ],
        "presentation": {
          "title": "Transaction Time (DB inclusive)",
          "notes": "Displays the sum of all transaction times per transaction for the default time period"
        }
      },
      {
        "visualization": "heatmap",
        "layout": {
          "width": 3,
          "height": 1,
          "row": 5,
          "column": 1
        },
        "data": [
          {
            "nrql": "SELECT histogram(databaseDuration) FROM Transaction FACET name SINCE 1 day ago LIMIT 20"
          }
        ],
        "presentation": {
          "title": "Accumulated DB Time by Histogram",
          "notes": "Displays the database durations in a histogram"
        }
      }
    ],
    "filter": {
      "event_types": [
        "Transaction"
      ],
      "attributes": []
    }
  }
}