Postgres query for top DB consumers giving wrong results for bigger intervals.
search cancel

Postgres query for top DB consumers giving wrong results for bigger intervals.

book

Article ID: 410648

calendar_today

Updated On:

Products

DX Operational Observability

Issue/Introduction

The query shown below works only up to 15-minute interval in case of the 6-hour outcome does not return the right values. 

{
    "query": [
        {
            "op": "FROM",
            "querySpecifier": {
                "op": "SPEC",
                "sourceNameSpecifier": {
                    "op": "REGEX",
                    "pattern": "[^\\|]*\\|($host)\\|.*"
                },
                "attributeNameSpecifier": {
                    "op": "REGEX",
                    "pattern": "Postgres Databases\\|($postgresServer).*\\|Databases\\|.*\\:Transactions Executed"
                }
            }
        },
        {
            "op": "WINDOW",
            "every": "5m"
        },
        {
            "op": "GROUP",
            "columns": [
                "metric.source",
                "metric.path"
            ]
        },
        {
            "op": "NASS_AGG",
            "column": "data.value"
        },
        {
            "op": "DIFFERENCE",
            "column": "data.value",
            "negative": false,
            "as": "difference",
            "timeSrc": "window.timestart"
        },
{
            "op": "GROUP"
        },

        {
            "op": "TOP",
            "column": "difference",
            "n" : 6
        },
       {
            "op": "ORDER",
            "columns": [{
                 "column": "difference",
            "sortDescending" : true
            }]
        },
       {
            "op": "KEEP",
            "columns": [
                "metric.source", 
                "metric.path",
                "difference",
                "window.timestart"
            ]
        }
    ]
}

Cause

DE643279

Resolution

Wrong values injected to the WINDOW operation. Conditional fix will be released in HotFix 2 for 25.1 DXO2 on-prem release. Once installed, the query needs to be updated.