Back to top icon

New Relic Developers

NRQL

The New Relic Query Language is a powerful, SQL-like query syntax that lets you access your data in real time.

With NRQL, you can query any of the default event data being reported by New Relic, plus any custom events and attributes you’ve added.

 

NRQL syntax is comparable to ANSI SQL:

    SELECT function(attribute) [AS 'label'][, ...] 
     FROM event
     [WHERE attribute [comparison] [AND|OR ...]][AS 'label'][, ...]
     [FACET attribute | function(attribute)]
     [LIMIT number]
     [SINCE time]
     [UNTIL time]
     [WITH TIMEZONE timezone]
     [COMPARE WITH time]
     [TIMESERIES time]

NRQL queries can be as simple as fetching rows of data in a raw tabular form to inspect individual events:

-- Fetch a list of New Relic Browser PageView events
SELECT * FROM PageView

NRQL queries can also do extremely powerful calculations before the data is presented to you, such as crafting funnels based on the way people actually use your website:

-- See how many users visit, signup, browse and purchase from your site as a funnel
SELECT funnel(session, 
    WHERE pageUrl='http://www.demotron.com/' AS 'Visited Homepage',
    WHERE pageUrl='http://www.demotron.com/signup' AS 'Signed Up', 
    WHERE pageUrl='http://www.demotron.com/browse' AS 'Browsed Items', 
    WHERE pageUrl='http://www.demotron.com/checkout' AS 'Made Purchase') 
    FROM PageView 
    SINCE 12 hours ago

Using NRQL, you can customize your New Relic experience by crafting diverse dashboards in New Relic Insights that show your data from multiple angles. These dashboards can be shared with technical and non-technical stakeholders alike.

tech-nrql

Learn more and start building

Group 7 Created with Sketch.

Documentation

For an overview of NRQL syntax, see Introduction to NRQL. For a detailed description of all available functions, see NRQL syntax, components, and functions.

Group 9 Created with Sketch.

NRU Tutorials

To learn how to query and narrow a large data store by a specific parameter, watch the tutorial on Filtering queries with NRQL.

Group 8 Created with Sketch.

Community Forum

Connect with other developers in the New Relic Explorers Hub

GitHub

For examples of integrations and other technologies, see our GitHub repo.