Our Data Plus option addresses the maturing observability needs of engineering teams with simple and affordable per-GB pricing by combining our existing data capabilities with industry-leading security, scale, and performance. Included are improvements and new capabilities such as extended data indexing retention, logs obfuscation, FedRAMP, and more for up to 56% in bundled savings at $0.50 per gigabyte.

You’ll also get longer query durations as part of Data Plus. Currently, the original data option allows a query duration of just one minute. Data Plus increases the maximum query duration time for queries using New Relic Query Language (NRQL) and NerdGraph. Specifically, Data Plus customers:

  • Can run NRQL queries through NerdGraph for up to 10 minutes
  • Can run regular NRQL queries for a maximum of two minutes.

Why should you use NRQL?

As business systems become more complex, you'll sometimes need to search through large datasets to find the information you need. With NRQL (used in the NRQL Query builder or NerdGraph API), you can effectively observe data across your entire tech stack, build custom dashboards and alerts, and investigate your data for answers to business problems. And, with Data Plus' new query duration limits, you can query a larger dataset without your request timing out.

To start utilizing these extended query limits from Data Plus, you can:

Watch the next video or continue reading to see how to use NerdGraph to run queries on your larger databases.

Understanding query duration in NerdGraph

With Data Plus, you'll avoid the problems that accompany limited querying time, like increased mean time to detection (MTTD) and lower visibility due to failed queries. 

Before getting started, we recommend looking at the NerdGraph explorer tutorial and retrieving your New Relic API key. Once you have it, you will need to retrieve your ID. Here's the NRQL query to do that:  

{
 actor {
   user {
     name
     id
   }
 }
}

A synchronous NRQL query duration is suitable for smaller queries like this and most others that don't involve querying millions of data points. However, for larger more complex data volumes, one minute may not provide enough time for the query to retrieve results. In the following example, let's use a NRQL query in NerdGraph to look at transactions from two months ago.

{
   actor {
      account(id: YOUR_ACCOUNT_ID) {
         nrql(query: "SELECT count(*) FROM Transaction since 2 months ago") {
            results
         }
      }
   }
}

However, let's say the previous query was unable to pull data from two months ago. If that is the case, you'll see the message NRDB query duration exceeded the set timeout. So, we'll need to instead query through NerdGraph to obtain our results.

How to use long-running queries with Data Plus

To take advantage of queries that can run for up to ten minutes, you can run NRQL queries via NerdGraph, our GraphQL API. These longer queries are suitable for New Relic instances that process millions of events daily.

{
   actor {
      account(id: 1) {
         nrql(query: "SELECT count(*) FROM Transaction since 2 months ago, async: true) {
            results
            queryProgress {
               queryId
               resultExpiration
               retryAfter
               retryDeadline
            }
         }
      }
   }
}

By utilizing async: true, this query will run and return results in the background without risk of interruption. When this query completes, you can then retrieve the query search results through this command. We recommend copying and pasting your queryId  to a secure location so you can remember it when running a NerdGraph query and retrieve the results when the query is completed.

{
  actor {
    nrqlQueryProgress(accounts: YOUR_ACCOUNT_ID, queryID: “YOUR_QUERY_ID”
      results
    }
  }
}

Utilizing NerdGraph queries can also reduce query interruption risk from browser timeouts or HTTP connection failures. You can also allow retrieval of your query results at a later time and queries can be repeated verbatim until it returns results or an error.