Get results from new relic in sorted order

Get results from newrelic in sorted order

  • I am have newrelic datasource with click stream events. How do i fetch this data in ordered time range. When i give since and Until query, it is giving latest records near to until not in ordered manner. Can someone help me how to fetch records in given time range?

Query i am using right now :
SELECT * FROM Download since '1970-01-01 00:00:00' until '2019-07-08 13:41:52' limit 500


Hi @rajeev3 - By adding WITH TIMEZONE at the end of your query it will be set to the specified timezone, otherwise the default is UTC.

Forum topic on the subject.

1 Like

I have a column timestamp which stores epochtime. Now i want results to be sorted in ascending order on timestamp. How can i enforce that.

See below metadata of current response :

        "metadata": {
    "eventTypes": [
    "eventType": "Download",
    "openEnded": false,
    "beginTime": "1970-01-01T00:00:00Z",
    "endTime": "2019-07-08T13:41:52Z",
    "beginTimeMillis": 0,
    "endTimeMillis": 1562593312000,
    "rawSince": "'1970-01-01 00:00:00'",
    "rawUntil": "'2019-07-08 13:41:52'",
    "rawCompareWith": "",
    "guid": "a125a19f-4436-3df41-5b72-b693a7ba7f85",
    "routerGuid": "649bdsd565-242a-3f66-1cba-a217fe5e677f",
    "messages": [],
    "contents": [
        "function": "events",
        "limit": 500,
        "order": {
          "column": "timestamp",
          "descending": true

You can try adding ORDER BY timestamp but this is not supported functionality and may not work as expected.

You could add your vote to the ORDER BY feature request.

1 Like

Thanks for sharing that @stefan_garnham -

@rajeev3 - Let us know if there’s anything else we can help with beyond adding your +1 to the feature idea here.

1 Like

Order by is working for me. Thank you for the help


Glad to hear you got what you need!