To return bucketed results, use the
FACET buckets() clause in a NRQL query. A bucketing query has the structure:
SELECT FUNCTION(ATTRIBUTE) FROM DATA_TYPE FACET buckets(ATTRIBUTE, CEILING_VALUE, NUMBER_OF_BUCKETS)
Bucketing can be used with any attribute that is stored as a numerical value in the New Relic database.
To create a chart that shows the average duration of ranges of database calls:
- Create a NRQL statement with a
SELECTstatement for an attribute; for example,
- Add a
FACETclause that facets on buckets for another attribute; for example,
This query computes the average duration for each of the 10 buckets, with an upper limit of 400. All values above our upper limit of 400 are grouped in the last bucket, “>=360.0”.
SELECT average(duration) FROM TransactionSINCE 12 hours agoFACET buckets(databaseCallCount, 400, 10)
This query returns the following results:
Here' an example of a NRQL query with segments broken out into ten buckets. The bottom bucket will include outliers, so you may want to adjust accordingly.
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's data security and licenses documentation.