{
  "annotations":{"list":[{"builtIn":1,"datasource":{"type":"datasource","uid":"grafana"},"enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations & Alerts","target":{"limit":100,"matchAny":false,"tags":[],"type":"dashboard"},"type":"dashboard"}]},
  "author":"Ruohang Feng (rh@vonng.com)",
  "description":"PostgreSQL Database Overview",
  "editable":true,
  "fiscalYearStartMonth":0,
  "graphTooltip":0,
  "id":null,
  "license":"https://pigsty.io/docs/about/license/",
  "links":[
    { "asDropdown":true,"icon":"external link","includeVars":true,"keepTime":true,"tags":["Pigsty","PGSQL","Overview"],"targetBlank":false,"title":"Overview","tooltip":"","type":"dashboards","url":"" },{ "asDropdown":true,"icon":"external link","includeVars":true,"keepTime":true,"tags":["Pigsty","PGSQL","Cluster"] ,"targetBlank":false,"title":"Cluster" ,"tooltip":"","type":"dashboards","url":"" },
    { "asDropdown":true,"icon":"external link","includeVars":true,"keepTime":true,"tags":["Pigsty","PGSQL","Instance"],"targetBlank":false,"title":"Instance","tooltip":"","type":"dashboards","url":"" },{ "asDropdown":true,"icon":"external link","includeVars":true,"keepTime":true,"tags":["Pigsty","PGSQL","Database"],"targetBlank":false,"title":"Database","tooltip":"","type":"dashboards","url":"" }
  ],
  "panels":[
    {"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":0},"id":100,"panels":[],"title":"Overview","type":"row"},
    {
      "datasource":{"type":"marcusolsson-static-datasource","uid":"ds-static"},
      "description":"",
      "fieldConfig":{
        "defaults":{"color":{"mode":"thresholds"},"mappings":[],"max":2.5,"min":0,"thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"}]}},
        "overrides":[
          { "matcher":{"id":"byFrameRefID","options":"A"},"properties":[{"id":"links","value":[{"title":"PGSQL Instance : ${ins}","url":"/d/pgsql-instance?var-ins=${ins}&${__url_time_range}"}]}] },{ "matcher":{"id":"byFrameRefID","options":"B"},"properties":[{"id":"links","value":[{"title":"PGSQL Cluster : ${cls}","url":"/d/pgsql-cluster?var-cls=${cls}&${__url_time_range}"}]}]   },
          { "matcher":{"id":"byFrameRefID","options":"C"},"properties":[{"id":"links","value":[{"title":"PGCAT Database : ${ins}.${datname}","url":"/d/pgcat-database?var-dsn=$ins.$datname"}]}]   }
        ]
      },
      "gridPos":{"h":6,"w":6,"x":0,"y":1},
      "id":147,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"horizontal","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"/.*/","values":true},"showPercentChange":false,"text":{"titleSize":16,"valueSize":16},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"marcusolsson-static-datasource","uid":"ds-static"},"frame":{"fields":[{"config":{},"name":"Database","type":"string","values":["${datname}"]}],"meta":{},"name":""},"hide":false,"refId":"C" },
        { "datasource":{"type":"marcusolsson-static-datasource","uid":"ds-static"},"frame":{"fields":[{"config":{},"name":"Instance","type":"string","values":["$ins"]}],"meta":{},"name":""}      ,"hide":false,"refId":"A" },
        { "datasource":{"type":"marcusolsson-static-datasource","uid":"ds-static"},"frame":{"fields":[{"config":{},"name":"Cluster","type":"string","values":["${cls}"]}],"meta":{},"name":""}     ,"hide":false,"refId":"B" }
      ],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"All instances among pgsql cluster ${cls}\n\nInstance: Goto PGSQL Instance\n\nIP: Goto PGSQL Node\n\nStatus: Goto PGSQL Service\n\nLoad: max(cpu,postgres,pgbouncer)\n\nSpace: Disk space usage max(all device)\n\nProxy: session number, Goto Haproxy Admin Page",
      "fieldConfig":{
        "defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"inspect":false},"mappings":[],"max":1.2,"min":0,"thresholds":{"mode":"absolute","steps":[{"color":"#e3e3e3e0"}]}},
        "overrides":[
          {"matcher":{"id":"byName","options":"Instance"},"properties":[{"id":"links","value":[{"title":"PGSQL Database : ${__data.fields.Instance}.${datname}","url":"/d/pgsql-database?var-ins=${__data.fields.Instance}&var-datname=${datname}&${__url_time_range}"}]},{"id":"custom.width"}]},
          {"matcher":{"id":"byName","options":"IP"},"properties":[{"id":"custom.width","value":110},{"id":"links","value":[{"title":"Node Instance : ${__data.fields.IP}","url":"/d/node-instance?var-id=${__data.fields.IP}&${__url_time_range}"}]}]},
          {
            "matcher":{"id":"byName","options":"Role"},
            "properties":[
              { "id":"custom.width"      ,"value":80                                                                                                                                             },{ "id":"mappings"          ,"value":[{"options":{"0":{"color":"#3e668f","index":0,"text":"primary"},"1":{"color":"#346f36cc","index":1,"text":"replica"}},"type":"value"}]         },
              { "id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"}                                                                                                  },{ "id":"links"             ,"value":[{"title":"PGSQL Service for ${cls}-${__data.fields.Role}","url":"/d/pgsql-service?var-svc=${cls}-${__data.fields.Role}&${__url_time_range}"}] }
            ]
          },{
            "matcher":{"id":"byName","options":"Load"},
            "properties":[
              { "id":"custom.cellOptions","value":{"mode":"gradient","type":"gauge"}                                                                                                                                                                                                         },
              { "id":"color"             ,"value":{"mode":"thresholds"}                                                                                                                                                                                                                      },
              { "id":"unit"              ,"value":"percentunit"                                                                                                                                                                                                                              },
              { "id":"custom.width"      ,"value":120                                                                                                                                                                                                                                        },
              { "id":"thresholds"        ,"value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":0.1},{"color":"#fcdb72","value":0.3},{"color":"#f79f64","value":0.5},{"color":"red","value":0.7},{"color":"#b783af","value":0.9},{"color":"text","value":1}]} },
              { "id":"decimals"          ,"value":1                                                                                                                                                                                                                                          },
              { "id":"mappings"          ,"value":[{"options":{"-1":{"color":"transparent","index":0,"text":"N/A"}},"type":"value"}]                                                                                                                                                         }
            ]
          },
          {"matcher":{"id":"byName","options":"TPS"},"properties":[{"id":"custom.width","value":80},{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#3e668f","value":32},{"color":"#f79f64","value":32000}]}},{"id":"custom.cellOptions","value":{"type":"color-text"}}]},
          {"matcher":{"id":"byName","options":"QPS"},"properties":[{"id":"custom.width","value":80},{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#3e668f","value":32},{"color":"#f79f64","value":32000}]}},{"id":"custom.cellOptions","value":{"type":"color-text"}}]},
          {
            "matcher":{"id":"byName","options":"Conn"},
            "properties":[{"id":"custom.width","value":80},{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":4},{"color":"#EAB839","value":20},{"color":"#EF843C","value":40},{"color":"#E24D42","value":80},{"color":"#b783af","value":100},{"color":"text","value":400}]}},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
          },
          {"matcher":{"id":"byName","options":"Up"},"properties":[{"id":"custom.width","value":80},{"id":"mappings","value":[{"options":{"0":{"color":"#cc4637d9","index":0,"text":"Dead"},"1":{"color":"#346f36cc","index":1,"text":"Alive"}},"type":"value"}]},{"id":"custom.cellOptions","value":{"type":"color-background"}}]}
        ]
      },
      "gridPos":{"h":6,"w":9,"x":6,"y":1},
      "id":116,
      "links":[{"title":"PGSQL Instance : ${primary}","url":"/d/pgsql-instance?var-ins=${primary}&${__url_time_range}"}],
      "options":{"cellHeight":"sm","footer":{"countRows":false,"fields":"","reducer":["sum"],"show":false},"showHeader":true,"sortBy":[{"desc":false,"displayName":"Instance"}]},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"min by (ins,ip) (up{job=\"pgsql\", cls=\"$cls\"})"    ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (ins) (pg:ins:load1{cls=\"$cls\"})"            ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},                    "exemplar":false,"expr":"sum by (ins) (pg:ins:xact_total_rate1m{cls=\"$cls\"})","format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"C" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"min by (ins,ip) (pg_in_recovery{cls=\"$cls\"})"       ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"D" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},                    "exemplar":false,"expr":"max by (ins) (pg:ins:num_backends{cls=\"$cls\"})"     ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"E" }
      ],
      "title":"",
      "transformations":[
        {"id":"seriesToColumns","options":{"byField":"ins"}},
        {
          "id":"organize",
          "options":{
            "excludeByName":{
              "Time":true,
              "Time 1":true,
              "Time 10":true,
              "Time 2":true,
              "Time 3":true,
              "Time 4":true,
              "Time 6":true,
              "Time 8":true,
              "Time 9":true,
              "Value #A":false,
              "Value #B":false,
              "Value #H":false,
              "__name__":true,
              "__name__ 1":true,
              "__name__ 2":true,
              "__name__ 3":true,
              "__name__ 5":true,
              "__name__ 7":true,
              "cls":true,
              "cls 1":true,
              "cls 2":true,
              "cls 3":true,
              "cls 4":true,
              "cls 5":true,
              "cls 6":true,
              "cls 7":true,
              "instance":false,
              "instance 1":true,
              "instance 2":false,
              "instance 3":true,
              "instance 4":true,
              "instance 5":true,
              "instance 6":true,
              "ip 2":true,
              "ip 3":true,
              "ip 4":true,
              "ip 5":true,
              "ip 6":true,
              "ip 7":true,
              "job":true,
              "job 1":true,
              "job 2":true,
              "job 3":true,
              "job 4":true,
              "job 5":true,
              "job 6":true,
              "job 7":true
            },
            "indexByName":{"Time 1":9,"Time 2":10,"Time 3":11,"Time 4":12,"Time 5":13,"Time 6":15,"Value #A":0,"Value #B":4,"Value #C":5,"Value #D":1,"Value #E":7,"Value #G":6,"ins":2,"instance":8,"ip 1":3,"ip 2":14},
            "renameByName":{"Time 4":"","Value #A":"Up","Value #B":"Load","Value #C":"TPS","Value #D":"Role","Value #E":"Conn","Value #F":"RT","Value #G":"LB Conn","Value #H":"LB","Value #I":"QPS","Value #J":"LB Clients","Value #K":"Lag","cls 1":"","cls 2":"","ins":"Instance","instance":"HAProxy","instance 2":"","ip":"IP","ip 1":"IP"}
          }
        }
      ],
      "type":"table"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Database of this cluster ${cls}",
      "fieldConfig":{
        "defaults":{"color":{"mode":"fixed"},"custom":{"align":"center","cellOptions":{"type":"auto"},"inspect":false},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]}},
        "overrides":[
          {
            "matcher":{"id":"byName","options":"Database"},
            "properties":[
              { "id":"links"             ,"value":[{"title":"PGSQL Cluster Database ${__data.fields.Database}","url":"/d/pgsql-database?var-cls=${cls}&var-ins=${ins}&var-datname=${__data.fields.Database}&${__url_time_range}"}] },
              { "id":"mappings"          ,"value":[{"options":{"postgres":{"color":"#3e668f","index":2},"template0":{"color":"#f79f64","index":0},"template1":{"color":"#fcdb72","index":1}},"type":"value"}]                      },
              { "id":"custom.cellOptions","value":{"type":"color-text"}                                                                                                                                                            },
              { "id":"color"             ,"value":{"fixedColor":"#3e668f","mode":"fixed"}                                                                                                                                          },
              { "id":"filterable"                                                                                                                                                                                                  },
              { "id":"mappings"          ,"value":[{"options":{"postgres":{"color":"#808080","index":2},"template0":{"color":"#c0c0c0e0","index":0},"template1":{"color":"#a8a8a8e0","index":1}},"type":"value"}]                  }
            ]
          },{
            "matcher":{"id":"byName","options":"Size"},
            "properties":[
              { "id":"custom.width"      ,"value":80                                                                                                                                                                              },
              { "id":"unit"              ,"value":"decbytes"                                                                                                                                                                      },
              { "id":"thresholds"        ,"value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":1000000000},{"color":"#fcdb72","value":1000000000000},{"color":"#f79f64","value":10000000000000}]} },
              { "id":"custom.cellOptions","value":{"type":"color-text"}                                                                                                                                                           },
              { "id":"custom.cellOptions","value":{"type":"color-text"}                                                                                                                                                           },
              { "id":"color"             ,"value":{"mode":"thresholds"}                                                                                                                                                           },
              { "id":"decimals"          ,"value":1                                                                                                                                                                               }
            ]
          },{
            "matcher":{"id":"byName","options":"Age"},
            "properties":[
              { "id":"thresholds"        ,"value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":60000000},{"color":"#EAB839","value":200000000},{"color":"#f79f64","value":600000000},{"color":"red","value":1000000000},{"color":"#b783af","value":2000000000},{"color":"text","value":2137483647}]} },
              { "id":"custom.cellOptions","value":{"type":"color-text"}                                                                                                                                                                                                                                                              },
              { "id":"unit"              ,"value":"percentunit"                                                                                                                                                                                                                                                                      },
              { "id":"custom.width"      ,"value":60                                                                                                                                                                                                                                                                                 },
              { "id":"color"             ,"value":{"mode":"thresholds"}                                                                                                                                                                                                                                                              },
              { "id":"decimals"          ,"value":2                                                                                                                                                                                                                                                                                  }
            ]
          },
          {"matcher":{"id":"byName","options":"TPS"},"properties":[{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#346f36cc"},{"color":"#f79f64","value":30000}]}},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"custom.width","value":55},{"id":"color","value":{"mode":"thresholds"}},{"id":"decimals","value":1}]},
          {
            "matcher":{"id":"byName","options":"Status"},
            "properties":[
              { "id":"custom.width"      ,"value":100                                                                                                                                                                                                                                                                                                                                                   },
              { "id":"mappings"          ,"value":[{"options":{"0":{"color":"#505050d4","index":1,"text":"Template0"},"1":{"color":"text","index":2,"text":"RejectConn"},"2":{"color":"#818181c4","index":3,"text":"Template"},"3":{"color":"#346f36cc","index":4,"text":"Normal"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"N/A"}},"type":"special"}] },
              { "id":"custom.cellOptions","value":{"mode":"basic","type":"color-background"}                                                                                                                                                                                                                                                                                                            }
            ]
          },{
            "matcher":{"id":"byName","options":"Session"},
            "properties":[
              { "id":"custom.cellOptions","value":{"type":"color-text"}                                                                                                                                                                                                                             },
              { "id":"thresholds"        ,"value":{"mode":"absolute","steps":[{"color":"transparent"},{"color":"#3e668f","value":1},{"color":"#346f36cc","value":10},{"color":"#f79f64","value":40},{"color":"#cc4637d9","value":80},{"color":"#b783af","value":100},{"color":"text","value":400}]} },
              { "id":"color"             ,"value":{"mode":"thresholds"}                                                                                                                                                                                                                             },
              { "id":"custom.width"      ,"value":70                                                                                                                                                                                                                                                },
              { "id":"custom.cellOptions","value":{"mode":"gradient","type":"color-background"}                                                                                                                                                                                                     }
            ]
          },{
            "matcher":{"id":"byName","options":"ConnLimit"},
            "properties":[
              { "id":"custom.width"      ,"value":85                                                                                                                                                                                                                                                                                },
              { "id":"custom.cellOptions","value":{"type":"color-text"}                                                                                                                                                                                                                                                             },
              { "id":"color"                                                                                                                                                                                                                                                                                                        },
              { "id":"mappings"          ,"value":[{"options":{"-1":{"color":"#3e668f","index":1,"text":"NO LIMIT"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"N/A"}},"type":"special"},{"options":{"from":0,"result":{"color":"#f79f64","index":2},"to":99999999},"type":"range"}] }
            ]
          },{
            "matcher":{"id":"byName","options":"OID"},
            "properties":[{"id":"custom.width","value":90},{"id":"links","value":[{"title":"PGCAT Database : ${ins}.${__data.fields.Database}","url":"/d/pgcat-database?var-dsn=${ins}.${__data.fields.Database}"}]},{"id":"mappings","value":[{"options":{"from":0,"result":{"color":"#bfbfbf33","index":0},"to":10},"type":"range"}]},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
          }
        ]
      },
      "gridPos":{"h":6,"w":9,"x":15,"y":1},
      "id":66,
      "options":{"cellHeight":"sm","footer":{"countRows":false,"fields":"","reducer":["sum"],"show":false},"showHeader":true,"sortBy":[{"desc":true,"displayName":"OID"}]},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},                    "exemplar":false,"expr":"sum by (datname) (pg_size_bytes{ins=\"$ins\", datname!~\"wal|log\"})"                       ,"format":"table",             "instant":true,"interval":"","legendFormat":"Age"       ,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (datname) (pg_db_datid{ins=\"$ins\"})"                                               ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"Conn Limit","refId":"G" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},                    "exemplar":false,"expr":"max by (datname) (pg:db:age{ins=\"$ins\"})"                                                 ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"Commit"    ,"refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},                    "exemplar":false,"expr":"max by (datname) (1 - pg_db_is_template{ins=\"$ins\"} + pg_db_allow_conn{ins=\"$ins\"} * 2)","format":"table","hide":false,"instant":true,"interval":"","legendFormat":"Status"    ,"refId":"C" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},                    "exemplar":false,"expr":"sum by (datname) (pg_activity_count{ins=\"$ins\"})"                                         ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"Session"   ,"refId":"D" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},                    "exemplar":false,"expr":"sum by (datname) (pg:db:xact_commit_rate1m{ins=\"$ins\"})"                                  ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"TPS"       ,"refId":"E" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (datname) (pg_db_conn_limit{ins=\"$ins\"})"                                          ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"Conn Limit","refId":"F" }
      ],
      "title":"",
      "transformations":[
        {"id":"seriesToColumns","options":{"byField":"datname"}},
        {
          "id":"organize",
          "options":{
            "excludeByName":{"Time 1":true,"Time 10":true,"Time 2":true,"Time 3":true,"Time 4":true,"Time 5":true,"Time 6":true,"Time 7":true,"Time 8":true,"Time 9":true},
            "indexByName":{"Time 1":8,"Time 2":9,"Time 3":10,"Time 4":11,"Time 5":12,"Time 6":13,"Time 7":14,"Value #A":2,"Value #B":3,"Value #C":7,"Value #D":4,"Value #E":5,"Value #F":6,"Value #G":1,"datname":0},
            "renameByName":{"Time 1":"","Time 7":"","Value #A":"Size","Value #B":"Age","Value #C":"Status","Value #D":"Session","Value #E":"TPS","Value #F":"ConnLimit","Value #G":"OID","Value #H":"Current","Value #I":"Disable","Value #J":"Pause","datname":"Database","host":"Target","real_datname":"Datname"}
          }
        }
      ],
      "type":"table"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Xacts for ${ins}","url":"/d/pgsql-xacts?var-ins=${ins}&viewPanel=113&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":32},{"color":"#f79f64","value":32000}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":0,"y":7},
      "id":46,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"pg:db:xact_commit_rate1m{ins=\"$ins\", datname=\"$datname\"}","interval":"","legendFormat":"Commit","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Xacts : Rollback for ${ins}","url":"/d/pgsql-xacts?var-ins=${ins}&viewPanel=99&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"},{"color":"#fcdb72","value":1},{"color":"#f79f64","value":4},{"color":"red","value":8}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":2,"y":7},
      "id":57,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"pg:db:xact_rollback_rate1m{ins=\"$ins\", datname=\"$datname\"}","interval":"","legendFormat":"Rollback","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Session: iXact for ${ins}.${datname}","url":"/d/pgsql-session?var-ins=${ins}&viewPanel=107&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"},{"color":"#fcdb72","value":1},{"color":"#f79f64","value":2},{"color":"red","value":4},{"color":"#b783af","value":8},{"color":"text","value":16}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":4,"y":7},
      "id":89,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"sum(pg:db:ixact_backends{ins=\"$ins\", datname=\"$datname\"})","interval":"","legendFormat":"iXact","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":50,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":0,
            "pointSize":4,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"normal"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[
            { "title":"PGSQL TABLE for ${__field.labels.relname}"                                          ,"url":"/d/pgsql-table?var-ins=${ins}&var-cls=${cls}&var-datname=${__field.labels.datname}&var-relname=${__field.labels.relname}&${__url_time_range}" },
            { "title":"PGCAT for ${__field.labels.ins}.${__field.labels.datname}.${__field.labels.relname}","url":"/d/pgcat-table?var-dsn=${__field.labels.ins}.${__field.labels.datname}&var-relname=${__field.labels.relname}"                                 }
          ],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"qps"
        },
        "overrides":[]
      },
      "gridPos":{"h":5,"w":9,"x":6,"y":7},
      "id":108,
      "links":[{"title":"PGSQL Tables : ${ins}.${datname}","url":"/d/pgsql-tables?var-ins=${ins}&var-cls=${cls}&var-datname=${datname}&${__url_time_range}"}],
      "options":{"legend":{"calcs":["max"],"displayMode":"list","placement":"bottom","showLegend":false},"tooltip":{"hideZeros":false,"mode":"single","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"pg:table:scan_rate1m{ins=\"$ins\", datname=\"$datname\"}","interval":"","intervalFactor":2,"legendFormat":"{{ relname }}","refId":"B"}],
      "title":"Table Scan",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":60,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":0,
            "pointSize":4,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"normal"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[
            { "title":"PGSQL Query ${__field.labels.query}"                                                    ,"url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${__field.labels.datname}&var-query=${__field.labels.query}&${__url_time_range}" },
            { "title":"PGCAT Query for ${__field.labels.ins}.${__field.labels.datname}.${__field.labels.query}","url":"/d/pgcat-query?var-dsn=${__field.labels.ins}.${__field.labels.datname}&var-query=${__field.labels.query}"                                 }
          ],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"qps"
        },
        "overrides":[]
      },
      "gridPos":{"h":5,"w":9,"x":15,"y":7},
      "id":110,
      "links":[{"title":"PGSQL Query : ${ins}.${datname}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${datname}&${__url_time_range}&viewPanel=369"}],
      "options":{"legend":{"calcs":["max"],"displayMode":"list","placement":"bottom","showLegend":false},"tooltip":{"hideZeros":false,"mode":"single","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"pg:query:call_rate1m{ins=\"$ins\", datname=\"$datname\"}","interval":"","intervalFactor":2,"legendFormat":"{{ query }}","refId":"B"}],
      "title":"Query QPS",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Persist : Size for ${ins}","url":"/d/pgsql-persist?var-ins=${ins}&viewPanel=160&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":1000000000},{"color":"#fcdb72","value":1000000000000},{"color":"#f79f64","value":10000000000000}]},
          "unit":"decbytes"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":0,"y":10},
      "id":49,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"sum(pg_size_bytes{ins=\"$ins\", datname=\"$datname\"})","interval":"","legendFormat":"Size","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Persist : Size for ${ins}","url":"/d/pgsql-persist?var-ins=${ins}&viewPanel=232&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":1000000000},{"color":"#fcdb72","value":1000000000000},{"color":"#f79f64","value":10000000000000}]},
          "unit":"decbytes"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":2,"y":10},
      "id":83,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"sum(rate(pg_db_temp_bytes{ins=\"$ins\", datname=\"$datname\"}[5m]))","interval":"","legendFormat":"Temp","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Session : Backends for ${ins}.${datname}","url":"/d/pgsql-session?var-ins=${ins}&viewPanel=103&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":4},{"color":"#fcdb72","value":20},{"color":"#f79f64","value":40},{"color":"red","value":80},{"color":"#b783af","value":100},{"color":"text","value":400}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":4,"y":10},
      "id":64,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"pg_db_numbackends{ins=\"$ins\",datname=\"$datname\"}","interval":"","legendFormat":"Backend","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "fieldConfig":{
        "defaults":{"color":{"mode":"thresholds"},"custom":{"align":"auto","cellOptions":{"type":"auto"},"inspect":false},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]}},
        "overrides":[
          {"matcher":{"id":"byName","options":"Table"},"properties":[{"id":"links","value":[{"title":"${__data.fields.Table}","url":"/d/pgsql-table?var-ins=${ins}&var-cls=${cls}&var-datname=${datname}&var-relname=${__data.fields.Table}&${__url_time_range}"}]}]},
          {
            "matcher":{"id":"byName","options":"QPS"},
            "properties":[
              { "id":"custom.width"      ,"value":80                                                                                                                                                                                                       },
              { "id":"thresholds"        ,"value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"super-light-green","value":1},{"color":"light-green","value":10},{"color":"semi-dark-green","value":100},{"color":"dark-green","value":1000}]} },
              { "id":"color"             ,"value":{"mode":"thresholds"}                                                                                                                                                                                    },
              { "id":"custom.cellOptions","value":{"type":"color-text"}                                                                                                                                                                                    },
              { "id":"mappings"          ,"value":[{"options":{"match":"null+nan","result":{"color":"transparent","index":0,"text":"-"}},"type":"special"}]                                                                                                }
            ]
          },{
            "matcher":{"id":"byName","options":"Rows"},
            "properties":[
              { "id":"custom.width"      ,"value":100                                                                                                                                                                                                                                                                                                           },
              { "id":"unit"              ,"value":"locale"                                                                                                                                                                                                                                                                                                      },
              { "id":"thresholds"        ,"value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":1000},{"color":"super-light-green","value":1000000000},{"color":"#fcdb72","value":10000000000},{"color":"#f79f64","value":100000000000},{"color":"#cc4637d9","value":1000000000000},{"color":"#b783af","value":10000000000000}]} },
              { "id":"custom.cellOptions","value":{"type":"color-text"}                                                                                                                                                                                                                                                                                         }
            ]
          },{
            "matcher":{"id":"byName","options":"Size"},
            "properties":[
              {"id":"custom.width","value":100},{"id":"unit","value":"decbytes"},{"id":"decimals","value":1},{"id":"custom.cellOptions","value":{"type":"color-text"}},
              {"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"super-light-blue","value":8192},{"color":"super-light-green","value":8193},{"color":"#346f36cc","value":1000000},{"color":"#fcdb72","value":1000000000},{"color":"#f79f64","value":10000000000},{"color":"red","value":10000000000},{"color":"#b783af","value":100000000000},{"color":"text","value":1000000000000}]}}
            ]
          },
          {"matcher":{"id":"byName","options":"Scan"},"properties":[{"id":"custom.align","value":"right"},{"id":"unit","value":"locale"},{"id":"custom.width","value":120}]}
        ]
      },
      "gridPos":{"h":10,"w":9,"x":6,"y":12},
      "id":95,
      "options":{"cellHeight":"sm","footer":{"countRows":false,"fields":"","reducer":["sum"],"show":false},"showHeader":true,"sortBy":[{"desc":true,"displayName":"Scan"}]},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},                    "exemplar":false,"expr":"sum by (relname) (pg:table:scan_rate1m{ins=\"$ins\", datname=\"$datname\"})"                                                                          ,"format":"table",             "instant":true,"interval":"","legendFormat":"","refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"sum by (relname) (pg_table_n_live_tup{ins=\"$ins\", datname=\"$datname\"})"                                                                           ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"sum by (relname) (pg_table_size_bytes{ins=\"$ins\", datname=\"$datname\"})"                                                                           ,"format":"table","hide":true ,"instant":true,"interval":"","legendFormat":"","refId":"C" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"sum by (relname) (pg_table_idx_scan{ins=\"$ins\", datname=\"$datname\"}) \n+ sum by (relname) (pg_table_seq_scan{ins=\"$ins\", datname=\"$datname\"})","format":"table","hide":false,"instant":true,"interval":"","legendFormat":"","refId":"D" }
      ],
      "title":"",
      "transformations":[
        {"id":"seriesToColumns","options":{"byField":"relname"}},
        {"id":"organize","options":{"excludeByName":{"Time":true,"Time 1":true,"Time 2":true,"Time 3":true,"__name__":true,"cls":true,"datname":true,"ins":true},"indexByName":{"Time 1":5,"Time 2":6,"Time 3":7,"Time 4":8,"Value #A":1,"Value #B":3,"Value #C":4,"Value #D":2,"relname":0},"renameByName":{"Value":"Scan","Value #A":"QPS","Value #B":"Rows","Value #C":"Size","Value #D":"Scan","relname":"Table"}}}
      ],
      "type":"table"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "fieldConfig":{
        "defaults":{"custom":{"align":"center","cellOptions":{"type":"auto"},"filterable":false,"inspect":false},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},"unit":"none"},
        "overrides":[
          {"matcher":{"id":"byName","options":"Query"},"properties":[{"id":"links","value":[{"title":"PGSQL Query : ${ins}.${datname}.${__data.fields.Query}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${datname}&var-query=${__data.fields.Query}&${__url_time_range}"}]},{"id":"unit","value":"string"},{"id":"custom.minWidth","value":200}]},
          {
            "matcher":{"id":"byName","options":"RT"},
            "properties":[
              { "id":"custom.cellOptions","value":{"type":"color-text"}                                                                                                                                                                   },
              { "id":"thresholds"        ,"value":{"mode":"absolute","steps":[{"color":"#346f36cc"},{"color":"#fcdb72","value":0.001},{"color":"#f79f64","value":0.002},{"color":"red","value":0.004},{"color":"#b783af","value":0.008}]} },
              { "id":"unit"              ,"value":"s"                                                                                                                                                                                     },
              { "id":"custom.width"      ,"value":100                                                                                                                                                                                     },
              { "id":"mappings"          ,"value":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"N/A"}},"type":"special"}]                                                                                    }
            ]
          },{
            "matcher":{"id":"byName","options":"Call"},
            "properties":[
              { "id":"custom.width"      ,"value":72                                                                                                                                                                                                                                                         },
              { "id":"unit"              ,"value":"short"                                                                                                                                                                                                                                                    },
              { "id":"thresholds"        ,"value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"super-light-green","value":1000},{"color":"#fcdb72","value":1000000},{"color":"#f79f64","value":1000000000},{"color":"red","value":1000000000000},{"color":"#b783af","value":1000000000000000}]} },
              { "id":"mappings"          ,"value":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"N/A"}},"type":"special"}]                                                                                                                                                       },
              { "id":"custom.cellOptions","value":{"type":"color-text"}                                                                                                                                                                                                                                      }
            ]
          },
          {"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"custom.width","value":80},{"id":"decimals","value":1},{"id":"unit","value":"ms"}]},
          {
            "matcher":{"id":"byName","options":"QPS"},
            "properties":[{"id":"custom.width","value":80},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"super-light-green","value":0.1},{"color":"#346f36cc","value":1},{"color":"#EAB839","value":4},{"color":"#f79f64","value":16},{"color":"red","value":64},{"color":"#b783af","value":256},{"color":"text","value":1024}]}}]
          },
          {"matcher":{"id":"byName","options":"Database"},"properties":[{"id":"links","value":[{"title":"PGSQL Database for ${__data.fields.Database}","url":"/d/pgsql-database?var-ins=${ins}&var-datname=${__data.fields.Database}&${__url_time_range}"}]},{"id":"custom.minWidth","value":150}]},
          {"matcher":{"id":"byName","options":"WAL"},"properties":[{"id":"unit","value":"bytes"},{"id":"custom.width","value":80}]}
        ]
      },
      "gridPos":{"h":10,"w":9,"x":15,"y":12},
      "id":118,
      "options":{"cellHeight":"sm","footer":{"countRows":false,"fields":"","reducer":["sum"],"show":false},"showHeader":true,"sortBy":[{"desc":true,"displayName":"QPS"}]},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (datname, query) (pg_query_calls{ins=\"$ins\", datname=\"$datname\"}) > 0","format":"table",             "instant":true,"interval":"","legendFormat":"{{ query }}","refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (query) (pg_query_exec_time{ins=\"$ins\", datname=\"$datname\"})"         ,"format":"table",             "instant":true,"interval":"","legendFormat":"{{ query }}","refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (query) (pg:query:rt_1m{ins=\"$ins\", datname=\"$datname\"})"             ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"{{ query }}","refId":"C" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (query) (pg:query:call_rate1m{ins=\"$ins\", datname=\"$datname\"})"       ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"{{ query }}","refId":"D" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (query) (pg_query_wal_bytes{ins=\"$ins\", datname=\"$datname\"})"         ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"{{ query }}","refId":"E" }
      ],
      "title":"",
      "transformations":[
        {"id":"seriesToColumns","options":{"byField":"query"}},
        {
          "id":"organize",
          "options":{
            "excludeByName":{"Time":true,"Time 1":true,"Time 2":true,"Time 3":true,"Time 4":true,"Time 5":true,"Time 6":true,"Time 7":true,"Time 8":true,"datname":true,"ins":true},
            "indexByName":{"Time 1":5,"Time 2":7,"Time 3":8,"Time 4":9,"Time 5":10,"Value #A":3,"Value #B":4,"Value #C":2,"Value #D":1,"Value #E":11,"datname":6,"query":0},
            "renameByName":{"Time 1":"RT (rate1m)","Value #A":"Call","Value #B":"Time","Value #C":"RT","Value #D":"QPS","Value #E":"WAL","Value #F":"Max","Value #G":"Call (rate1h)","Value #H":"Time (rate1h)","datname":"Database","ins":"","query":"Query"}
          }
        }
      ],
      "type":"table"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "decimals":2,
          "links":[{"title":"PGSQL Persist : Age for ${ins}","url":"/d/pgsql-persist?var-ins=${ins}&viewPanel=228&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "max":1,
          "min":0,
          "noValue":"\u2205",
          "thresholds":{"mode":"percentage","steps":[{"color":"#346f36cc"},{"color":"#fcdb72","value":2},{"color":"#f79f64","value":10},{"color":"red","value":30},{"color":"#b783af","value":90},{"color":"text","value":100}]},
          "unit":"percentunit"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":0,"y":13},
      "id":63,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"pg:db:age{ins=\"$ins\", datname=\"$datname\"} / 2147483647","interval":"","legendFormat":"Age","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Session : PG Conn Usage for ${ins}.${datname}","url":"/d/pgsql-session?var-ins=$ins&viewPanel=113&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":0.1},{"color":"#fcdb72","value":0.3},{"color":"#f79f64","value":0.5},{"color":"red","value":0.7},{"color":"#b783af","value":0.9},{"color":"text","value":1}]},
          "unit":"percentunit"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":2,"y":13},
      "id":93,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"pg:db:conn_usage{ins=\"$ins\", datname=\"$datname\"}","interval":"","legendFormat":"PG Conn","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "decimals":1,
          "links":[{"title":"PGSQL Persist : Block Hit Ratio for ${ins}","url":"/d/pgsql-persist?var-ins=${ins}&viewPanel=188&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "max":1,
          "min":0,
          "noValue":"\u2205",
          "thresholds":{"mode":"absolute","steps":[{"color":"text"},{"color":"#b783af","value":0.8},{"color":"red","value":0.9},{"color":"#f79f64","value":0.95},{"color":"#fcdb72","value":0.99},{"color":"#346f36cc","value":0.999}]},
          "unit":"percentunit"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":4,"y":13},
      "id":86,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["mean"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"pg:db:blks_hit_ratio1m{ins=\"$ins\", datname=\"$datname\"}","interval":"","legendFormat":"Hit Ratio","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Databases : Row Fetched for ${cls}.${datname}","url":"/d/pgsql-databases?var-cls=${cls}&var-datname=${datname}&viewPanel=1618&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":0,"y":16},
      "id":127,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg:db:tup_fetched_rate1m{ins=\"$ins\", datname=\"$datname\"}","interval":"","legendFormat":"Row Fetch / s","range":true,"refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Databases : Row Fetched for ${cls}.${datname}","url":"/d/pgsql-databases?var-cls=${cls}&var-datname=${datname}&viewPanel=1621&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":2,"y":16},
      "id":128,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg:db:tup_modified_rate1m{ins=\"$ins\", datname=\"$datname\"}","interval":"","legendFormat":"Row Modify / s","range":true,"refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Session : Active Time for ${ins}.${datname}","url":"/d/pgsql-session?var-ins=$ins&viewPanel=154&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":0.1},{"color":"#fcdb72","value":0.3},{"color":"#f79f64","value":0.5},{"color":"red","value":0.7},{"color":"#b783af","value":0.9},{"color":"text","value":1}]},
          "unit":"percentunit"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":4,"y":16},
      "id":129,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg:db:active_time_rate1m{ins=\"$ins\", datname=\"$datname\"}\n/ pg:db:num_backends{ins=\"$ins\", datname=\"$datname\"}","interval":"","legendFormat":"Active Time","range":true,"refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Xacts : Locks ${ins}","url":"/d/pgsql-xacts?var-ins=${ins}&viewPanel=104&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":4},{"color":"#fcdb72","value":20},{"color":"#f79f64","value":40},{"color":"red","value":80},{"color":"#b783af","value":100},{"color":"text","value":400}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":0,"y":19},
      "id":130,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg:db:rlock_count{ins=\"$ins\",datname=\"$datname\"}","interval":"","legendFormat":"Read Locks","range":true,"refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Xacts : Locks ${ins}","url":"/d/pgsql-xacts?var-ins=${ins}&viewPanel=104&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":1},{"color":"#fcdb72","value":10},{"color":"#f79f64","value":20},{"color":"#cc4637d9","value":40},{"color":"#b783af","value":80},{"color":"text","value":160}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":2,"y":19},
      "id":131,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg:db:wlock_count{ins=\"$ins\",datname=\"$datname\"}","interval":"","legendFormat":"Write Locks","range":true,"refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Xacts : Locks ${ins}","url":"/d/pgsql-xacts?var-ins=${ins}&viewPanel=104&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#cc4637d9","value":1},{"color":"#7771a4","value":4}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":4,"y":19},
      "id":132,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg:db:xlock_count{ins=\"$ins\",datname=\"$datname\"}","interval":"","legendFormat":"EX Locks","range":true,"refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":30,
            "gradientMode":"hue",
            "hideFrom":{"graph":false,"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"smooth",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"normal"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[{"title":"PGSQL Database for ${__field.labels.datname}","url":"/d/pgsql-database?var-ins=${ins}&var-cls=${cls}&var-datname=${__field.labels.datname}&${__url_time_range}"},{"title":"PGSQL Tables for ${__field.labels.datname}","url":"/d/pgsql-tables?var-ins=${ins}&var-datname=${__field.labels.datname}&${__url_time_range}"}],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"none"
        },
        "overrides":[{"matcher":{"id":"byName","options":"Instance"},"properties":[{"id":"custom.stacking","value":{"group":"A","mode":"none"}},{"id":"custom.lineWidth","value":0}]}]
      },
      "gridPos":{"h":6,"w":12,"x":0,"y":22},
      "id":114,
      "options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"sum(pg_db_numbackends{ins=\"$ins\"})","hide":true,"interval":"","intervalFactor":1,"legendFormat":"Instance","refId":"B"},{"exemplar":false,"expr":"pg_db_numbackends{ins=\"$ins\"}","interval":"","intervalFactor":1,"legendFormat":"{{ datname }}","refId":"A"}],
      "title":"Session",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":30,
            "gradientMode":"hue",
            "hideFrom":{"graph":false,"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"smooth",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"normal"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[{"title":"PGSQL Database for ${__field.labels.datname}","url":"/d/pgsql-database?var-ins=${ins}&var-cls=${cls}&var-datname=${__field.labels.datname}&${__url_time_range}"},{"title":"PGSQL Tables for ${__field.labels.datname}","url":"/d/pgsql-tables?var-ins=${ins}&var-datname=${__field.labels.datname}&${__url_time_range}"}],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"short"
        },
        "overrides":[{"matcher":{"id":"byName","options":"Instance"},"properties":[{"id":"custom.stacking","value":{"group":"A","mode":"none"}},{"id":"custom.lineWidth","value":0}]}]
      },
      "gridPos":{"h":6,"w":12,"x":12,"y":22},
      "id":113,
      "options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"pg:ins:xact_commit_rate1m{ins=\"$ins\"}","hide":false,"interval":"","intervalFactor":1,"legendFormat":"Instance","refId":"B"},{"exemplar":false,"expr":"pg:db:xact_commit_rate1m{ins=\"$ins\"}","interval":"","intervalFactor":1,"legendFormat":"{{ datname }}","refId":"A"}],
      "title":"Transactions",
      "type":"timeseries"
    },
    {"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":28},"id":117,"panels":[],"title":"Pgbouncer","type":"row"},
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Session : Pool Servers for ${ins}.${datname}","url":"/d/pgsql-session?var-ins=$ins&viewPanel=140&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":4},{"color":"#fcdb72","value":20},{"color":"#f79f64","value":40},{"color":"red","value":80},{"color":"#b783af","value":100},{"color":"text","value":400}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":0,"y":29},
      "id":80,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"sum(pgbouncer:db:active_servers{ins=\"$ins\",datname=\"$datname\"})","interval":"","legendFormat":"Pool Server","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Session : Pool Clients for ${ins}.${datname}","url":"/d/pgsql-session?var-ins=$ins&viewPanel=141&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":4},{"color":"#f79f64","value":2000}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":2,"y":29},
      "id":78,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"sum(pgbouncer:db:active_clients{ins=\"$ins\",datname=\"$datname\"})","interval":"","legendFormat":"Pool Client","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Session : PGB Conn Usage for ${ins}.${datname}","url":"/d/pgsql-session?var-ins=$ins&viewPanel=114&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":0.1},{"color":"#fcdb72","value":0.3},{"color":"#f79f64","value":0.5},{"color":"red","value":0.7},{"color":"#b783af","value":0.9},{"color":"text","value":1}]},
          "unit":"percentunit"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":4,"y":29},
      "id":111,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"pgbouncer:db:conn_usage{ins=\"$ins\", datname=\"$datname\"}","interval":"","legendFormat":"PGB Conn","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Database in Pgbouncer of this instance ${ins}",
      "fieldConfig":{
        "defaults":{"color":{"mode":"thresholds"},"custom":{"align":"center","cellOptions":{"type":"auto"},"inspect":false},"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]}},
        "overrides":[
          {"matcher":{"id":"byRegexp","options":"/Pool.*/"},"properties":[{"id":"custom.width","value":80},{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":1}]}},{"id":"custom.cellOptions","value":{"type":"color-text"}}]},
          {
            "matcher":{"id":"byName","options":"Conn"},
            "properties":[{"id":"custom.width","value":65},{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":10},{"color":"#EAB839","value":30},{"color":"#f79f64","value":50},{"color":"red","value":70},{"color":"#b783af","value":90},{"color":"text","value":100}]}},{"id":"custom.cellOptions","value":{"type":"color-text"}}]
          },
          {"matcher":{"id":"byName","options":"Conn Max"},"properties":[{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"red"},{"color":"#f79f64","value":10},{"color":"#fcdb72","value":64},{"color":"#346f36cc","value":100},{"color":"semi-dark-green","value":200},{"color":"dark-green","value":400}]}},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"custom.width","value":85}]},
          {
            "matcher":{"id":"byName","options":"Conn Usage"},
            "properties":[{"id":"custom.width","value":110},{"id":"thresholds","value":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":0.1},{"color":"#fcdb72","value":0.3},{"color":"#f79f64","value":0.5},{"color":"red","value":0.7},{"color":"#b783af","value":0.9},{"color":"text","value":1}]}},{"id":"custom.cellOptions","value":{"type":"color-text"}},{"id":"unit","value":"percentunit"}]
          },{
            "matcher":{"id":"byRegexp","options":"/Disabled|Paused/"},
            "properties":[{"id":"mappings","value":[{"options":{"0":{"color":"#346f36cc","index":1,"text":"F"},"1":{"color":"#f79f64","index":2,"text":"T"}},"type":"value"},{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"N/A"}},"type":"special"}]},{"id":"custom.cellOptions","value":{"mode":"basic","type":"color-background"}}]
          },
          {"matcher":{"id":"byName","options":"Database"},"properties":[{"id":"links","value":[{"title":"PGSQL Database for ${__data.fields.Database}","url":"/d/pgsql-database?var-ins=${ins}&var-cls=${cls}&var-datname=${__data.fields.Database}&${__url_time_range}"}]},{"id":"custom.align","value":"left"}]},{"matcher":{"id":"byName","options":"Disabled"},"properties":[{"id":"custom.width","value":75}]},
          {"matcher":{"id":"byName","options":"Paused"},"properties":[{"id":"custom.width","value":70}]},{"matcher":{"id":"byName","options":"Pool Resv"},"properties":[{"id":"custom.width","value":87}]}
        ]
      },
      "gridPos":{"h":9,"w":18,"x":6,"y":29},
      "id":68,
      "options":{"cellHeight":"sm","footer":{"countRows":false,"fields":"","reducer":["sum"],"show":false},"showHeader":true,"sortBy":[{"desc":false,"displayName":"Database"}]},
      "pluginVersion":"12.0.0",
      "targets":[
        { "exemplar":false,"expr":"sum by (datname,host,real_datname) (pgbouncer_database_pool_size{ins=\"$ins\", datname!=\"pgbouncer\"})"                                                                                      ,"format":"table",             "instant":true,"interval":"","legendFormat":"Pool Size" ,"refId":"A" },
        { "exemplar":false,"expr":"sum by (datname) (pgbouncer_database_reserve_pool{ins=\"$ins\", datname!=\"pgbouncer\"})"                                                                                                     ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"Pool Resv" ,"refId":"B" },
        { "exemplar":false,"expr":"sum by (datname) (pgbouncer_database_current_connections{ins=\"$ins\", datname!=\"pgbouncer\"})"                                                                                              ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"Conn"      ,"refId":"C" },
        { "exemplar":false,"expr":"sum by (datname) (pgbouncer_database_max_connections{ins=\"$ins\", datname!=\"pgbouncer\"})"                                                                                                  ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"Conn Max"  ,"refId":"D" },
        { "exemplar":false,"expr":"sum by (datname) (pgbouncer_database_current_connections{ins=\"$ins\", datname!=\"pgbouncer\"}) / sum by (datname) (pgbouncer_database_max_connections{ins=\"$ins\", datname!=\"pgbouncer\"})","format":"table","hide":false,"instant":true,"interval":"","legendFormat":"Conn Usage","refId":"E" },
        { "exemplar":false,"expr":"sum by (datname) (pgbouncer_database_disabled{ins=\"$ins\", datname!=\"pgbouncer\"})"                                                                                                         ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"Disabled"  ,"refId":"F" },
        { "exemplar":false,"expr":"sum by (datname) (pgbouncer_database_paused{ins=\"$ins\", datname!=\"pgbouncer\"})"                                                                                                           ,"format":"table","hide":false,"instant":true,"interval":"","legendFormat":"Paused"    ,"refId":"G" }
      ],
      "title":"Databases in Pgbouncer",
      "transformations":[
        {"id":"seriesToColumns","options":{"byField":"datname"}},
        {
          "id":"organize",
          "options":{
            "excludeByName":{"Time":true,"Time 1":true,"Time 10":true,"Time 2":true,"Time 3":true,"Time 4":true,"Time 5":true,"Time 6":true,"Time 7":true,"Time 8":true,"Time 9":true},
            "indexByName":{"Time 1":10,"Time 2":11,"Time 3":12,"Time 4":13,"Time 5":14,"Time 6":15,"Time 7":16,"Value #A":2,"Value #B":3,"Value #C":4,"Value #D":5,"Value #E":6,"Value #F":7,"Value #G":8,"datname":0,"host":9,"real_datname":1},
            "renameByName":{"Time 1":"","Time 7":"","Value":"Pool Size","Value #A":"Pool Size","Value #B":"Pool Resv","Value #C":"Conn","Value #D":"Conn Max","Value #E":"Conn Usage","Value #F":"Disabled","Value #G":"Paused","Value #H":"","Value #I":"Disable","Value #J":"Pause","datname":"Database","host":"Host","real_datname":"Realname"}
          }
        }
      ],
      "type":"table"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Xacts for ${ins}","url":"/d/pgsql-xacts?var-ins=${ins}&viewPanel=80&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"},{"color":"#fcdb72","value":20000},{"color":"#f79f64","value":30000}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":0,"y":32},
      "id":60,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pgbouncer:db:xact_rate1m{ins=\"$ins\",datname=\"$datname\"}","interval":"","legendFormat":"TPS","range":true,"refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Xacts for ${ins}","url":"/d/pgsql-xacts?var-ins=${ins}&viewPanel=111&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"},{"color":"#fcdb72","value":1},{"color":"#f79f64","value":2},{"color":"red","value":4},{"color":"#b783af","value":8},{"color":"text","value":16}]},
          "unit":"s"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":2,"y":32},
      "id":81,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"pgbouncer:db:xact_rt_1m{ins=\"$ins\", datname=\"$datname\"}","interval":"","legendFormat":"Xact RT","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Session : Pool Queuing for ${ins}.${datname}","url":"/d/pgsql-session?var-ins=$ins&viewPanel=126&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"},{"color":"#fcdb72","value":1},{"color":"#f79f64","value":2},{"color":"red","value":4},{"color":"#b783af","value":8},{"color":"text","value":16}]},
          "unit":"none"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":4,"y":32},
      "id":44,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"sum by (cls) (pgbouncer_pool_waiting_clients{ins=\"$ins\", datname=\"$datname\"})","interval":"","legendFormat":"Queue","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{"color":{"mode":"thresholds"},"links":[{"title":"PGSQL Pgbouncer : QPS ${ins}","url":"/d/pgsql-pgbouncer?var-ins=${ins}&viewPanel=66&${__url_time_range}"}],"mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],"min":0,"thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"},{"color":"#f79f64","value":32000}]},"unit":"none"},
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":0,"y":35},
      "id":47,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pgbouncer:db:query_rate1m{ins=\"$ins\",datname=\"$datname\"}","interval":"","legendFormat":"QPS","range":true,"refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Pgbouncer : Query RT ${ins}","url":"/d/pgsql-pgbouncer?var-ins=${ins}&viewPanel=68&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "noValue":"\u2205",
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"},{"color":"#fcdb72","value":1},{"color":"#f79f64","value":2},{"color":"red","value":4},{"color":"#b783af","value":8},{"color":"text","value":16}]},
          "unit":"s"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":2,"y":35},
      "id":62,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"pgbouncer:db:query_rt_1m{ins=\"$ins\", datname=\"$datname\"}","interval":"","legendFormat":"Query RT","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Pgbouncer for ${ins}","url":"/d/pgsql-query?var-ins=${ins}&${__url_time_range}"}],
          "mappings":[{"options":{"match":"null+nan","result":{"color":"gray","index":0,"text":"\u2205"}},"type":"special"}],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"},{"color":"#346f36cc","value":1000},{"color":"#fcdb72","value":64000000},{"color":"#f79f64","value":100000000},{"color":"red","value":300000000}]},
          "unit":"Bps"
        },
        "overrides":[]
      },
      "gridPos":{"h":3,"w":2,"x":4,"y":35},
      "id":91,
      "options":{"colorMode":"background","graphMode":"area","justifyMode":"auto","orientation":"auto","percentChangeColorMode":"standard","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"showPercentChange":false,"text":{"titleSize":12,"valueSize":18},"textMode":"value_and_name","wideLayout":true},
      "pluginVersion":"12.0.0",
      "targets":[{"exemplar":false,"expr":"sum(pgbouncer:db:rx_rate1m{ins=\"$ins\", datname=\"$datname\"}) + sum(pgbouncer:db:tx_rate1m{ins=\"$ins\", datname=\"$datname\"})","interval":"","legendFormat":"Traffic","refId":"A"}],
      "title":"",
      "type":"stat"
    },
    {"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":38},"id":119,"panels":[],"title":"Metrics","type":"row"},
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Tuples fetched/returned from databases",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":3,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"cps"
        },
        "overrides":[{"matcher":{"id":"byName","options":"Returned"},"properties":[{"id":"color","value":{"fixedColor":"#24292e4d","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"Fetched"},"properties":[{"id":"color","value":{"fixedColor":"#346f36cc","mode":"fixed"}},{"id":"custom.lineWidth","value":2},{"id":"custom.fillOpacity","value":10}]}]
      },
      "gridPos":{"h":7,"w":12,"x":0,"y":39},
      "id":141,
      "links":[{"title":"PGSQL Databases : ${cls}.${datname}","url":"/d/pgsql-databases?var-cls=${cls}&datname=${datname}&${__url_time_range}"}],
      "options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"single","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_db_tup_fetched{ins=\"$ins\", datname=\"$datname\"}[5m])" ,             "interval":"","legendFormat":"Fetched" ,"range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_db_tup_returned{ins=\"$ins\", datname=\"$datname\"}[5m])","hide":false,"interval":"","legendFormat":"Returned","range":true,"refId":"B" }
      ],
      "title":"Row Returned / Fetched",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Tuples fetched, inserted, updated, delete among this cluster",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":50,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":0,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"normal"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"cps"
        },
        "overrides":[{"matcher":{"id":"byName","options":"DELETED"},"properties":[{"id":"color","value":{"fixedColor":"#cc4637d9","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"INSERTED"},"properties":[{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"UPDATED"},"properties":[{"id":"color","value":{"fixedColor":"#fcdb72","mode":"fixed"}}]}]
      },
      "gridPos":{"h":7,"w":12,"x":12,"y":39},
      "id":142,
      "links":[{"title":"PGSQL Databases : ${cls}.${datname}","url":"/d/pgsql-databases?var-cls=${cls}&datname=${datname}&${__url_time_range}"}],
      "options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"single","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_db_tup_inserted{ins=\"$ins\", datname=\"$datname\"}[1m])","hide":false,"interval":"","intervalFactor":2,"legendFormat":"INSERTED","range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_db_tup_updated{ins=\"$ins\", datname=\"$datname\"}[1m])" ,"hide":false,"interval":"","intervalFactor":2,"legendFormat":"UPDATED" ,"range":true,"refId":"C" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_db_tup_deleted{ins=\"$ins\", datname=\"$datname\"}[1m])" ,"hide":false,"interval":"","intervalFactor":2,"legendFormat":"DELETED" ,"range":true,"refId":"D" }
      ],
      "title":"Row Modified",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":2,
            "gradientMode":"hue",
            "hideFrom":{"graph":false,"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"smooth",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[{"title":"PGSQL Xacts for ${__field.labels.ins}","url":"/d/pgsql-xacts?var-ins=${__field.labels.ins}&${__url_time_range}"}],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"short"
        },
        "overrides":[{"matcher":{"id":"byName","options":"Instance"},"properties":[{"id":"custom.lineWidth","value":0},{"id":"custom.fillOpacity","value":20}]},{"matcher":{"id":"byName","options":"rollback"},"properties":[{"id":"color","value":{"fixedColor":"#cc4637d9","mode":"fixed"}}]},{"matcher":{"id":"byName","options":"commit"},"properties":[{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}}]}]
      },
      "gridPos":{"h":7,"w":12,"x":0,"y":46},
      "id":143,
      "options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_db_xact_commit{ins=\"$ins\", datname=\"$datname\"}[3m])"  ,"hide":false,"interval":"","intervalFactor":2,"legendFormat":"commit"  ,"range":true,"refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_db_xact_rollback{ins=\"$ins\", datname=\"$datname\"}[3m])","hide":false,"interval":"","intervalFactor":2,"legendFormat":"rollback","range":true,"refId":"A" }
      ],
      "title":"Xact Commit / Rollback",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":40,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":0,
            "pointSize":2,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"auto",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"s"
        },
        "overrides":[]
      },
      "gridPos":{"h":7,"w":12,"x":12,"y":46},
      "id":144,
      "options":{"legend":{"calcs":["max"],"displayMode":"table","placement":"right","showLegend":false,"sortBy":"Max","sortDesc":true},"tooltip":{"hideZeros":false,"mode":"single","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"max by (datname) (pg_activity_max_tx_duration{ins=\"$ins\", datname=\"$datname\", state=\"active\"})","interval":"","legendFormat":"Long Lived Xact","range":true,"refId":"A"}],
      "title":"Long Lived Xact",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"bars",
            "fillOpacity":55,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":1,
            "pointSize":5,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"never",
            "spanNulls":true,
            "stacking":{"group":"A","mode":"normal"},
            "thresholdsStyle":{"mode":"off"}
          },
          "decimals":0,
          "mappings":[],
          "thresholds":{"mode":"absolute","steps":[{"color":"green"}]},
          "unit":"short"
        },
        "overrides":[
          { "matcher":{"id":"byName","options":"AccessShareLock"}         ,"properties":[{"id":"color","value":{"fixedColor":"#56A64B","mode":"fixed"}}] },{ "matcher":{"id":"byName","options":"RowShareLock"}            ,"properties":[{"id":"color","value":{"fixedColor":"#8AB8FF","mode":"fixed"}}] },
          { "matcher":{"id":"byName","options":"RowExclusiveLock"}        ,"properties":[{"id":"color","value":{"fixedColor":"#3274D9","mode":"fixed"}}] },{ "matcher":{"id":"byName","options":"ShareUpdateExclusiveLock"},"properties":[{"id":"color","value":{"fixedColor":"#F2CC0C","mode":"fixed"}}] },
          { "matcher":{"id":"byName","options":"ShareLock"}               ,"properties":[{"id":"color","value":{"fixedColor":"#CC9D00","mode":"fixed"}}] },{ "matcher":{"id":"byName","options":"ShareRowExclusiveLock"}   ,"properties":[{"id":"color","value":{"fixedColor":"#FF780A","mode":"fixed"}}] },
          { "matcher":{"id":"byName","options":"ExclusiveLock"}           ,"properties":[{"id":"color","value":{"fixedColor":"#E02F44","mode":"fixed"}}] },{ "matcher":{"id":"byName","options":"AccessExclusiveLock"}     ,"properties":[{"id":"color","value":{"fixedColor":"#A352CC","mode":"fixed"}}] }
        ]
      },
      "gridPos":{"h":7,"w":12,"x":0,"y":53},
      "id":145,
      "options":{"legend":{"calcs":["lastNotNull","max"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Max","sortDesc":true},"tooltip":{"hideZeros":false,"mode":"single","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"sum by (mode) (pg_lock_count{ins=\"$ins\", datname=\"$datname\"})","interval":"","legendFormat":"{{ mode }}","range":true,"refId":"A"}],
      "title":"Locks",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Database 4k blocks hit ratio in last 1 minute of database ${datname}\n\n`pg_stat_database`:\n\n`blks_hit` / (`blks_read` + `blks_hit`) in last minute",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "axisSoftMax":1,
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":2,
            "gradientMode":"hue",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":1,
            "pointSize":2,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"auto",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "decimals":2,
          "links":[{"title":"PGSQL Database for ${__field.labels.datname}","url":"/d/pgsql-database?var-ins=${ins}&var-datname=${__field.labels.datname}&${__url_time_range}"}],
          "mappings":[],
          "thresholds":{"mode":"absolute","steps":[{"color":"#3e668f"}]},
          "unit":"percentunit"
        },
        "overrides":[{"matcher":{"id":"byName","options":"Hit Ratio"},"properties":[{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}},{"id":"custom.fillOpacity","value":20}]},{"matcher":{"id":"byName","options":"100%"},"properties":[{"id":"color","value":{"fixedColor":"#cc4637d9","mode":"fixed"}},{"id":"custom.fillOpacity","value":1},{"id":"custom.fillBelowTo","value":"Hit Ratio"}]}]
      },
      "gridPos":{"h":7,"w":12,"x":12,"y":53},
      "id":146,
      "options":{"legend":{"calcs":["min"],"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Min","sortDesc":false},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg:db:blks_hit_ratio1m{ins=\"$ins\", datname='$datname'}",             "interval":"","legendFormat":"Hit Ratio","range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"1"                                                       ,"hide":false,"interval":"","legendFormat":"100%"     ,"range":true,"refId":"B" }
      ],
      "title":"Blocks Hit Ratio (1m)",
      "type":"timeseries"
    },
    {"collapsed":false,"gridPos":{"h":1,"w":24,"x":0,"y":60},"id":120,"panels":[],"title":"Queries","type":"row"},
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Query QPS of this database ${datname} on ${ins} in last 5 minutes.\n\nrate 5m of `pg_stat_statements`.`calls`\nClick datapoint to check a specific query.",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":30,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":0,
            "pointSize":4,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"auto",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"normal"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[{"title":"PGSQL Query ${__field.labels.query}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${__field.labels.datname}&var-query=${__field.labels.query}&${__url_time_range}"}],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"ops"
        },
        "overrides":[
          { "matcher":{"id":"byName","options":"Postgres TPS"}                  ,"properties":[{"id":"custom.fillOpacity","value":0},{"id":"custom.stacking","value":{"group":"A","mode":"none"}},{"id":"custom.lineWidth","value":2},{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}},{"id":"custom.lineStyle","value":{"fill":"solid"}}]                                 },
          { "matcher":{"id":"byName","options":"Pgbouncer QPS"}                 ,"properties":[{"id":"color","value":{"fixedColor":"#346f36cc","mode":"fixed"}},{"id":"custom.stacking","value":{"group":"A","mode":"none"}},{"id":"custom.lineWidth","value":2},{"id":"color","value":{"mode":"palette-classic"}},{"id":"custom.lineStyle","value":{"fill":"solid"}}]                   },
          { "matcher":{"id":"byFrameRefID","options":"C"}                       ,"properties":[{"id":"color","value":{"fixedColor":"#24292ee6","mode":"fixed"}},{"id":"custom.fillOpacity","value":80},{"id":"custom.lineWidth","value":2},{"id":"custom.showPoints","value":"auto"},{"id":"custom.pointSize","value":4},{"id":"custom.stacking","value":{"group":"A","mode":"normal"}}] },
          { "matcher":{"id":"byRegexp","options":"/Pgbouncer QPS|Postgres TPS/"},"properties":[{"id":"custom.hideFrom","value":{"legend":false,"tooltip":false,"viz":true}}]                                                                                                                                                                                                             }
        ]
      },
      "gridPos":{"h":9,"w":12,"x":0,"y":61},
      "id":133,
      "links":[{"title":"PGSQL Query : ${ins}.${datname}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${datname}&${__url_time_range}&viewPanel=369"}],
      "options":{"legend":{"calcs":["max"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pgbouncer_stat_total_query_count{ins=\"$ins\", datname=\"$datname\"}[5m])","hide":false,"interval":"","intervalFactor":2,"legendFormat":"Pgbouncer QPS","range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_db_xact_commit{ins=\"$ins\", datname=\"$datname\"}[5m])"               ,"hide":false,"interval":"","intervalFactor":2,"legendFormat":"Postgres TPS" ,"range":true,"refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_query_calls{ins=\"$ins\", datname=\"$datname\"}[5m])"                  ,"hide":false,"interval":"","intervalFactor":2,"legendFormat":"{{ query }}"  ,"range":true,"refId":"D" }
      ],
      "title":"Query QPS (5m)",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Query RT of this database ${datname} on ${ins}.\n\nrate 5m of `total_exec_time` / `calls`\n\nClick datapoint to check a specific query.",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":0,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":1,
            "pointSize":4,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"auto",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"none"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[{"title":"PGSQL Query ${__field.labels.query}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${__field.labels.datname}&var-query=${__field.labels.query}&${__url_time_range}"}],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"s"
        },
        "overrides":[
          { "matcher":{"id":"byName","options":"Postgres RT"} ,"properties":[{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}},{"id":"custom.lineWidth","value":2},{"id":"custom.fillOpacity","value":2}]                                                                                    },
          { "matcher":{"id":"byName","options":"Pgbouncer RT"},"properties":[{"id":"color","value":{"fixedColor":"#346f36cc","mode":"fixed"}},{"id":"custom.lineWidth","value":2},{"id":"custom.fillOpacity","value":2}]                                                                                  },
          { "matcher":{"id":"byFrameRefID","options":"C"}     ,"properties":[{"id":"custom.lineWidth","value":2},{"id":"custom.showPoints","value":"always"},{"id":"custom.pointSize","value":5},{"id":"color","value":{"fixedColor":"#24292ee6","mode":"fixed"}},{"id":"custom.fillOpacity","value":20}] }
        ]
      },
      "gridPos":{"h":9,"w":12,"x":12,"y":61},
      "id":134,
      "links":[{"title":"PGSQL Query : ${ins}.${datname}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${datname}&${__url_time_range}&viewPanel=371"}],
      "options":{"legend":{"calcs":["max"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pgbouncer_stat_total_query_time{ins=\"$ins\", datname=\"$datname\"}[5m]) /\nrate(pgbouncer_stat_total_query_count{ins=\"$ins\", datname=\"$datname\"}[5m])","hide":false,"interval":"","intervalFactor":2,"legendFormat":"Pgbouncer RT","range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_db_active_time{ins=\"$ins\", datname=\"$datname\"}[5m]) /\nrate(pg_db_xact_commit{ins=\"$ins\", datname=\"$datname\"}[5m])"                             ,             "interval":"","intervalFactor":2,"legendFormat":"Postgres RT" ,"range":true,"refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"pg:query:rt_1m{ins=\"$ins\",datname=\"$datname\"}"                                                                                                              ,"hide":false,"interval":"","intervalFactor":2,"legendFormat":"{{ query }}" ,"range":true,"refId":"D" }
      ],
      "title":"Query RT (1m)",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Size by exec time spent in last hour, Colored by RT in last hour",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"thresholds"},
          "links":[{"title":"PGSQL Query : ${__data.fields.query}","url":"/d/pgsql-query?var-ins=${ins}&var-datname=${datname}&var-query=${__data.fields.query}&${__url_time_range}"},{"title":"PGCAT Query : ${__data.fields.query}","url":"/d/pgcat-query?var-dsn=${ins}.${datname}&var-query=${__data.fields.Query}&${__url_time_range}"}],
          "mappings":[],
          "thresholds":{"mode":"absolute","steps":[{"color":"super-light-blue"},{"color":"#3e668f","value":0.0001},{"color":"super-light-green","value":0.001},{"color":"#346f36cc","value":0.002},{"color":"#EAB839","value":0.01},{"color":"#f79f64","value":0.1},{"color":"red","value":1},{"color":"#b783af","value":60},{"color":"text","value":600}]},
          "unit":"locale"
        },
        "overrides":[{"matcher":{"id":"byName","options":"RT"},"properties":[{"id":"unit","value":"s"},{"id":"mappings","value":[{"options":{"match":"null+nan","result":{"color":"#808080","index":1,"text":"N/A"}},"type":"special"}]}]},{"matcher":{"id":"byName","options":"Query"},"properties":[{"id":"unit","value":"string"}]},{"matcher":{"id":"byName","options":"Time"},"properties":[{"id":"unit","value":"s"}]}]
      },
      "gridPos":{"h":9,"w":12,"x":0,"y":70},
      "id":135,
      "links":[{"title":"PGSQL Query : ${ins}.${datname}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${datname}&${__url_time_range}&viewPanel=402"}],
      "options":{"colorByField":"Value #B","colorField":"rt","labelFields":["Value #A","Value #B"],"sizeField":"Value #A","textField":"query","tiling":"treemapSquarify"},
      "pluginVersion":"2.1.0",
      "targets":[
        {
          "datasource":{"type":"postgres","uid":"cc8a3615-9c82-44d7-be42-07d8aa1cac68"},
          "editorMode":"code",
          "expr":"increase(pg_query_exec_time{ins=\"$ins\", datname=\"$datname\"}[1h])",
          "format":"table",
          "group":[],
          "hide":false,
          "legendFormat":"__auto",
          "metricColumn":"none",
          "range":true,
          "rawQuery":true,
          "rawSql":"SELECT queryid::TEXT AS qid, d.datname, r.rolname, s.rows AS value, s.mean_exec_time AS rt\nFROM pg_stat_statements s\n         LEFT JOIN pg_database d ON s.dbid = d.oid\n         LEFT JOIN pg_roles r ON s.userid = r.oid\nWHERE datname='$datname' AND rows > 0\nORDER BY calls DESC\nLIMIT 100;",
          "refId":"A",
          "select":[[{"params":["video_duration"],"type":"column"}]],
          "sql":{"columns":[{"parameters":[],"type":"function"}],"groupBy":[{"property":{"type":"string"},"type":"groupBy"}],"limit":50},
          "table":"predefined_message_translations1",
          "timeColumn":"created_time",
          "timeColumnType":"timestamp",
          "where":[{"name":"$__timeFilter","params":[],"type":"macro"}]
        },{
          "datasource":{"type":"postgres","uid":"cc8a3615-9c82-44d7-be42-07d8aa1cac68"},
          "editorMode":"code",
          "expr":"increase(pg_query_exec_time{ins=\"$ins\", datname=\"$datname\"}[1h]) /\n increase(pg_query_calls{ins=\"$ins\", datname=\"$datname\"}[1h])",
          "format":"table",
          "group":[],
          "hide":false,
          "legendFormat":"__auto",
          "metricColumn":"none",
          "range":true,
          "rawQuery":true,
          "rawSql":"SELECT queryid::TEXT AS qid, d.datname, r.rolname, s.rows AS value, s.mean_exec_time AS rt\nFROM pg_stat_statements s\n         LEFT JOIN pg_database d ON s.dbid = d.oid\n         LEFT JOIN pg_roles r ON s.userid = r.oid\nWHERE datname='$datname' AND rows > 0\nORDER BY calls DESC\nLIMIT 100;",
          "refId":"B",
          "select":[[{"params":["video_duration"],"type":"column"}]],
          "sql":{"columns":[{"parameters":[],"type":"function"}],"groupBy":[{"property":{"type":"string"},"type":"groupBy"}],"limit":50},
          "table":"predefined_message_translations1",
          "timeColumn":"created_time",
          "timeColumnType":"timestamp",
          "where":[{"name":"$__timeFilter","params":[],"type":"macro"}]
        }
      ],
      "title":"Exec Time / RT Matrix (1h)",
      "transformations":[{"id":"joinByField","options":{"byField":"query","mode":"outer"}},{"id":"organize","options":{"excludeByName":{"Time 1":true,"Time 2":true},"indexByName":{"Time 1":3,"Time 2":4,"Value #A":1,"Value #B":2,"query":0},"renameByName":{"Value #A":"Time","Value #B":"RT","query":"Query"}}}],
      "type":"marcusolsson-treemap-panel"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Numbers of rows returned of each query in this database ${datname} on ${ins} in last 5 minutes.\n\nrate 5m of `pg_stat_statements`.`calls`\nClick datapoint to check a specific query.",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":30,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":0,
            "pointSize":4,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"auto",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"normal"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[{"title":"PGSQL Query ${__field.labels.query}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${__field.labels.datname}&var-query=${__field.labels.query}&${__url_time_range}"}],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"rowsps"
        },
        "overrides":[
          { "matcher":{"id":"byName","options":"Postgres RPS"}    ,"properties":[{"id":"custom.fillOpacity","value":0},{"id":"custom.stacking","value":{"group":"A","mode":"none"}},{"id":"custom.lineWidth","value":2},{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}},{"id":"custom.lineStyle","value":{"fill":"solid"}}]                                 },
          { "matcher":{"id":"byFrameRefID","options":"C"}         ,"properties":[{"id":"color","value":{"fixedColor":"#24292ee6","mode":"fixed"}},{"id":"custom.fillOpacity","value":80},{"id":"custom.lineWidth","value":2},{"id":"custom.showPoints","value":"auto"},{"id":"custom.pointSize","value":4},{"id":"custom.stacking","value":{"group":"A","mode":"normal"}}] },
          { "matcher":{"id":"byRegexp","options":"/Postgres RPS/"},"properties":[{"id":"custom.hideFrom","value":{"legend":false,"tooltip":false,"viz":true}}]                                                                                                                                                                                                             }
        ]
      },
      "gridPos":{"h":9,"w":12,"x":12,"y":70},
      "id":136,
      "links":[{"title":"PGSQL Query : ${ins}.${datname}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${datname}&${__url_time_range}&viewPanel=404"}],
      "options":{"legend":{"calcs":["max"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_db_tup_returned{ins=\"$ins\", datname=\"$datname\"}[5m])","hide":false,"interval":"","intervalFactor":2,"legendFormat":"Postgres RPS","range":true,"refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_query_rows{ins=\"$ins\", datname=\"$datname\"}[5m])"     ,"hide":false,"interval":"","intervalFactor":2,"legendFormat":"{{ query }}" ,"range":true,"refId":"D" }
      ],
      "title":"Rows Returned (5m)",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Time spent on executing statements during last 1 hour.\n\nincrease1h of `pg_stat_statements`.`total_exec_time`",
      "fieldConfig":{
        "defaults":{"color":{"mode":"palette-classic"},"custom":{"hideFrom":{"legend":false,"tooltip":false,"viz":false}},"links":[{"title":"PGSQL Query ${__field.labels.query}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${__field.labels.datname}&var-query=${__field.labels.query}&${__url_time_range}"}],"mappings":[],"unit":"s"},
        "overrides":[{"matcher":{"id":"byFrameRefID","options":"A"},"properties":[{"id":"color","value":{"fixedColor":"#24292ecc","mode":"fixed"}}]},{"matcher":{"id":"byFrameRefID","options":"B"},"properties":[{"id":"color","value":{"mode":"palette-classic"}}]}]
      },
      "gridPos":{"h":9,"w":12,"x":0,"y":79},
      "id":137,
      "links":[{"title":"PGSQL Query : ${ins}.${datname}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${datname}&${__url_time_range}&viewPanel=362"}],
      "options":{"legend":{"displayMode":"table","placement":"right","showLegend":true,"sortBy":"Percent","sortDesc":true,"values":["percent","value"]},"pieType":"pie","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"tooltip":{"hideZeros":false,"mode":"single","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"increase(pg_query_exec_time{ins=\"$ins\", datname=\"$datname\"}[1h])","hide":false,"instant":true,"interval":"","legendFormat":"{{ query }}","refId":"B"}],
      "title":"Exec Time Spent (1h)",
      "type":"piechart"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Exec Time Spent of this database ${datname} on ${ins}.\n\nrate 5m of `pg_stat_statements`.`calls`\nClick datapoint to check a specific query.",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":30,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":0,
            "pointSize":4,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"auto",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"normal"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[{"title":"PGSQL Query ${__field.labels.query}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${__field.labels.datname}&var-query=${__field.labels.query}&${__url_time_range}"}],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"s"
        },
        "overrides":[
          { "matcher":{"id":"byName","options":"Postgres Time"} ,"properties":[{"id":"custom.fillOpacity","value":20},{"id":"custom.stacking","value":{"group":"A","mode":"none"}},{"id":"custom.lineWidth","value":2},{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}},{"id":"custom.lineStyle","value":{"fill":"solid"}}]                                },
          { "matcher":{"id":"byName","options":"Pgbouncer Time"},"properties":[{"id":"color","value":{"fixedColor":"#346f36cc","mode":"fixed"}},{"id":"custom.stacking","value":{"group":"A","mode":"none"}},{"id":"custom.lineWidth","value":2},{"id":"color","value":{"mode":"palette-classic"}},{"id":"custom.lineStyle","value":{"fill":"solid"}}]                   },
          { "matcher":{"id":"byFrameRefID","options":"C"}       ,"properties":[{"id":"color","value":{"fixedColor":"#24292ee6","mode":"fixed"}},{"id":"custom.fillOpacity","value":80},{"id":"custom.lineWidth","value":2},{"id":"custom.showPoints","value":"auto"},{"id":"custom.pointSize","value":4},{"id":"custom.stacking","value":{"group":"A","mode":"normal"}}] },
          { "matcher":{"id":"byRegexp","options":"/.*Time/"}    ,"properties":[{"id":"custom.hideFrom","value":{"legend":false,"tooltip":false,"viz":true}}]                                                                                                                                                                                                             }
        ]
      },
      "gridPos":{"h":9,"w":12,"x":12,"y":79},
      "id":138,
      "links":[{"title":"PGSQL Query : ${ins}.${datname}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${datname}&${__url_time_range}&viewPanel=403"}],
      "options":{"legend":{"calcs":["max"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pgbouncer_stat_total_query_time{ins=\"$ins\", datname=\"$datname\"}[5m])","hide":false,"interval":"","intervalFactor":2,"legendFormat":"Pgbouncer Time","range":true,"refId":"A" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_db_active_time{ins=\"$ins\", datname=\"$datname\"}[5m])"              ,"hide":false,"interval":"","intervalFactor":2,"legendFormat":"Postgres Time" ,"range":true,"refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_query_exec_time{ins=\"$ins\", datname=\"$datname\"}[5m])"             ,"hide":false,"interval":"","intervalFactor":2,"legendFormat":"{{ query }}"   ,"range":true,"refId":"D" }
      ],
      "title":"Exec Time Spent (5m)",
      "type":"timeseries"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Shared blocks access & read size in bytes, in last 1 hour of each query.\n\n`pg_stat_statements`: `share_blks_read` + `shared_blks_hit`",
      "fieldConfig":{
        "defaults":{"color":{"mode":"palette-classic"},"custom":{"hideFrom":{"legend":false,"tooltip":false,"viz":false}},"links":[{"title":"PGSQL Query ${__field.labels.query}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${__field.labels.datname}&var-query=${__field.labels.query}&${__url_time_range}"}],"mappings":[],"unit":"bytes"},
        "overrides":[{"matcher":{"id":"byFrameRefID","options":"A"},"properties":[{"id":"color","value":{"fixedColor":"#24292ecc","mode":"fixed"}}]},{"matcher":{"id":"byFrameRefID","options":"B"},"properties":[{"id":"color","value":{"mode":"palette-classic"}}]}]
      },
      "gridPos":{"h":9,"w":12,"x":0,"y":88},
      "id":139,
      "links":[{"title":"PGSQL Query : ${ins}.${datname}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${datname}&${__url_time_range}&viewPanel=401"}],
      "options":{"legend":{"displayMode":"table","placement":"right","showLegend":true,"values":["percent","value"]},"pieType":"pie","reduceOptions":{"calcs":["lastNotNull"],"fields":"","values":false},"tooltip":{"hideZeros":false,"mode":"single","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[{"datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"(increase(pg_query_sblk_read{ins=\"$ins\", datname=\"$datname\"}[1h]) +\nincrease(pg_query_sblk_hit{ins=\"$ins\", datname=\"$datname\"}[1h])) * 8192","hide":false,"instant":true,"interval":"","legendFormat":"{{ query }}","refId":"B"}],
      "title":"Blocks Access (1h)",
      "type":"piechart"
    },
    {
      "datasource":{"type":"prometheus","uid":"ds-prometheus"},
      "description":"Numbers of wal bytes generated of each query in this database ${datname} on ${ins} in last 5 minutes.\n\nrate 5m of `pg_stat_statements`.`wal_bytes`\n\nClick the data-point to check a specific query.",
      "fieldConfig":{
        "defaults":{
          "color":{"mode":"palette-classic"},
          "custom":{
            "axisBorderShow":false,
            "axisCenteredZero":false,
            "axisColorMode":"text",
            "axisLabel":"",
            "axisPlacement":"auto",
            "barAlignment":0,
            "barWidthFactor":0.6,
            "drawStyle":"line",
            "fillOpacity":30,
            "gradientMode":"none",
            "hideFrom":{"legend":false,"tooltip":false,"viz":false},
            "insertNulls":false,
            "lineInterpolation":"linear",
            "lineWidth":0,
            "pointSize":4,
            "scaleDistribution":{"type":"linear"},
            "showPoints":"auto",
            "spanNulls":false,
            "stacking":{"group":"A","mode":"normal"},
            "thresholdsStyle":{"mode":"off"}
          },
          "links":[{"title":"PGSQL Query ${__field.labels.query}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${__field.labels.datname}&var-query=${__field.labels.query}&${__url_time_range}"}],
          "mappings":[],
          "min":0,
          "thresholds":{"mode":"absolute","steps":[{"color":"#346f36cc"}]},
          "unit":"binBps"
        },
        "overrides":[
          { "matcher":{"id":"byName","options":"Postgres LSN"} ,"properties":[{"id":"custom.fillOpacity","value":0},{"id":"custom.stacking","value":{"group":"A","mode":"none"}},{"id":"custom.lineWidth","value":2},{"id":"color","value":{"fixedColor":"#3e668f","mode":"fixed"}},{"id":"custom.lineStyle","value":{"fill":"solid"}},{"id":"custom.hideFrom","value":{"legend":false,"tooltip":false,"viz":true}}] },
          { "matcher":{"id":"byName","options":"Pgbouncer QPS"},"properties":[{"id":"color","value":{"fixedColor":"#346f36cc","mode":"fixed"}},{"id":"custom.stacking","value":{"group":"A","mode":"none"}},{"id":"custom.lineWidth","value":2},{"id":"color","value":{"mode":"palette-classic"}},{"id":"custom.lineStyle","value":{"fill":"solid"}}]                                                                },
          { "matcher":{"id":"byFrameRefID","options":"C"}      ,"properties":[{"id":"color","value":{"fixedColor":"#24292ee6","mode":"fixed"}},{"id":"custom.fillOpacity","value":80},{"id":"custom.lineWidth","value":2},{"id":"custom.showPoints","value":"auto"},{"id":"custom.pointSize","value":4},{"id":"custom.stacking","value":{"group":"A","mode":"normal"}}]                                              }
        ]
      },
      "gridPos":{"h":9,"w":12,"x":12,"y":88},
      "id":140,
      "links":[{"title":"PGSQL Query : ${ins}.${datname}","url":"/d/pgsql-query?var-ins=${ins}&var-cls=${cls}&var-datname=${datname}&${__url_time_range}&viewPanel=406"}],
      "options":{"legend":{"calcs":["max"],"displayMode":"table","placement":"right","showLegend":true},"tooltip":{"hideZeros":false,"mode":"multi","sort":"none"}},
      "pluginVersion":"12.0.0",
      "targets":[
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_lsn{ins=\"$ins\"}[5m])"                                  ,"hide":false,"interval":"","intervalFactor":2,"legendFormat":"Postgres LSN","range":true,"refId":"B" },
        { "datasource":{"type":"prometheus","uid":"ds-prometheus"},"editorMode":"code","exemplar":false,"expr":"rate(pg_query_wal_bytes{ins=\"$ins\", datname=\"$datname\"}[5m])","hide":false,"interval":"","intervalFactor":2,"legendFormat":"{{ query }}" ,"range":true,"refId":"D" }
      ],
      "title":"WAL Bytes (5m)",
      "type":"timeseries"
    }
  ],
  "preload":false,
  "refresh":"",
  "schemaVersion":41,
  "tags":["Pigsty","PGSQL","Database"],
  "templating":{
    "list":[
      {"current":{},"datasource":{"type":"prometheus","uid":"ds-prometheus"},"definition":"label_values(pg_up, ins)","description":"Unique instance identifier (e.g pg-meta-1)","includeAll":false,"label":"Instance","name":"ins","options":[],"query":{"query":"label_values(pg_up, ins)","refId":"StandardVariableQuery"},"refresh":2,"regex":"","sort":1,"type":"query"},
      {
        "current":{},
        "datasource":{"type":"prometheus","uid":"ds-prometheus"},
        "definition":"label_values(pg_db_age{ins=\"$ins\"},datname)",
        "description":"Database name",
        "includeAll":false,
        "label":"Database",
        "name":"datname",
        "options":[],
        "query":{"query":"label_values(pg_db_age{ins=\"$ins\"},datname)","refId":"PrometheusVariableQueryEditor-VariableQuery"},
        "refresh":2,
        "regex":"(?!^template\\d$)(^.*$)",
        "sort":1,
        "type":"query"
      },{
        "current":{},
        "datasource":{"type":"prometheus","uid":"ds-prometheus"},
        "definition":"label_values(pg_up{ins=\"$ins\"} , instance)",
        "description":"IP address of this postgres instance",
        "hide":2,
        "includeAll":false,
        "label":"IP",
        "name":"ip",
        "options":[],
        "query":{"query":"label_values(pg_up{ins=\"$ins\"} , instance)","refId":"StandardVariableQuery"},
        "refresh":2,
        "regex":"/([0-9\\.]+)\\:\\d+/",
        "sort":1,
        "type":"query"
      },{
        "current":{},
        "datasource":{"type":"prometheus","uid":"ds-prometheus"},
        "definition":"label_values(pg_up{ins=\"$ins\"},  ins)",
        "description":"Sequence number of this instance, which is an unique integer among a postgres cluster",
        "hide":2,
        "includeAll":false,
        "label":"Sequence",
        "name":"seq",
        "options":[],
        "query":{"query":"label_values(pg_up{ins=\"$ins\"},  ins)","refId":"StandardVariableQuery"},
        "refresh":2,
        "regex":"/^[a-zA-Z0-9-_]+-(\\d+)$/",
        "sort":1,
        "type":"query"
      },{
        "current":{},
        "datasource":{"type":"prometheus","uid":"ds-prometheus"},
        "definition":"label_values(pg_up{ins=\"$ins\"}, cls)",
        "description":"Cluster identifier for this postgres instance, cls should be unique among entire environment. such as pg-meta, pg-test",
        "hide":2,
        "includeAll":false,
        "label":"Cluster",
        "name":"cls",
        "options":[],
        "query":{"query":"label_values(pg_up{ins=\"$ins\"}, cls)","refId":"StandardVariableQuery"},
        "refresh":2,
        "regex":"",
        "sort":1,
        "type":"query"
      },{
        "current":{},
        "datasource":{"type":"prometheus","uid":"ds-prometheus"},
        "definition":"label_values(node_uname_info{ins=\"$ins\"}, nodename)",
        "description":"Node name of current postgres instance",
        "hide":2,
        "includeAll":false,
        "label":"Node",
        "name":"node",
        "options":[],
        "query":{"query":"label_values(node_uname_info{ins=\"$ins\"}, nodename)","refId":"StandardVariableQuery"},
        "refresh":2,
        "regex":"",
        "sort":1,
        "type":"query"
      }
    ]
  },
  "time":{"from":"now-1h","to":"now"},
  "timepicker":{},
  "timezone":"browser",
  "title":"PGSQL Database",
  "uid":"pgsql-database",
  "version":1
}