• /
  • Log in

Use advanced (NRQL) mode to query data

While basic mode is an excellent choice for creating charts without needing to know how to write queries, working in advanced (NRQL) mode offers more power and additional features.

Any data specified in basic mode can be written as an NRQL query in advanced (NRQL) mode.

To see what your basic mode data specification looks like as an NRQL query, click the Advanced (NRQL) inline-advanced-nrql.png link from the basic page.

querybuilder05.png

Example of an advanced (NRQL) query.

Compare advanced (NRQL) mode query with basic mode specification

When you switch from basic mode to advanced (NRQL) mode, the query you see produces the exact same chart as the basic data specification.

Important

If your query was started using basic mode and if you make changes to that query using advanced (NRQL) mode, you cannot return to basic mode to edit that query.

Any additional changes may only be made in advanced (NRQL) mode.

Use this table to understand how basic mode specifications correspond to the equivalent NRQL query.

To set this

In basic mode, you enter ...

In advanced (NRQL) mode, you write ...

The event type, attribute, and function on that attribute

View a chart with Transaction : Name : unique_count

SELECT uniqueCount(name) FROM Transaction

Narrowing your results to show only those transactions with a 404 page not found error

Narrow results to httpResponseCode='404'

WHERE httpResponseCode = '404'

Enable a preliminary timeline view

not needed in basic mode

TIMESERIES — enables line chart type (required for initial chart view)

To see a separate value for each application with a 404 error

Facet by appName

FACET `appName`

To view the five applications with the most 404 errors

Limit 5 — default value is 10

LIMIT 5

To view errors over the last three hours

Select Last 3 hrs — converted to seconds in NRQL query

SINCE 10800 seconds ago

To enhance the results of sampling transaction data

This feature is run automatically in basic mode

EXTRAPOLATE

Notes about advanced (NRQL) mode

Queries written directly in NRQL can be more complex than queries written in basic mode. The NRQL documentation contains both reference information and query examples. This table identifies some items to keep in mind.

Item

Description

Prompts

For each statement or function in your query, you can view a list of valid options, with tooltips.

crop-prompt-nrql.png

Example of a prompt in advanced (NRQL) mode.

Events

You can use multiple event types in an NRQL query.

Attributes

You can use multiple attributes per event type in an NRQL query.

View previous queries

Once you run an NRQL query, use the My recent queries dropdown to view up the last 1,000 queries that you ran. The dropdown has a search box to help you find your query.

Working with basic mode and NRQL

If you start creating a chart using basic mode and then switch to advanced (NRQL), be aware that if you make any changes to the NRQL query, you will lose those changes in basic mode.

Autocompleter

The query builder’s autocompleter will display events and attributes reported within the last 60 minutes. An example of this is a process that runs once a day, such as a standard system health check that kicks off every morning at 6:00am. If you attempt to query the event at 7:05am, the event and subsequent attributes will not be visible in the autocomplete dropdown.

These events and attributes are still queryable by typing the exact string.

Multi query

When using the TIMESERIES clause you can run and compare up to 10 queries from different accounts.

To use multi query, enter your first query with TIMESERIES and run it. Once the results are rendered, the Add another query button is activated and you can add another query.

For more help

If you need more help, check out these support and learning resources:

Create issueEdit page
Copyright © 2021 New Relic Inc.