diff --git a/config/grafana/dashboards/Dashboard_8_Index health.json b/config/grafana/dashboards/Dashboard_10_Index health.json similarity index 98% rename from config/grafana/dashboards/Dashboard_8_Index health.json rename to config/grafana/dashboards/Dashboard_10_Index health.json index eca3c9b..27a0035 100644 --- a/config/grafana/dashboards/Dashboard_8_Index health.json +++ b/config/grafana/dashboards/Dashboard_10_Index health.json @@ -257,6 +257,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -377,6 +378,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -497,6 +499,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -618,7 +621,7 @@ "showLineNumbers": false, "showMiniMap": false }, - "content": "

\n Brought to you by Postgres AI\n \"Postgres.AI\"\n

\n", + "content": "

\n Brought to you by PostgresAI\n \"Postgres.AI\"\n

\n", "mode": "html" }, "pluginVersion": "12.0.2", @@ -719,7 +722,7 @@ }, "timepicker": {}, "timezone": "utc", - "title": "08. Index health -- \"Metrics are collected (part of health check); dashboard – TODO\"", + "title": "10. Aggregated index analysis", "uid": "db3b37d1-1540-4f7e-95c9-4082f2ca349e", "version": 11 } \ No newline at end of file diff --git a/config/grafana/dashboards/Dashboard_10_Single_index_analysis.json b/config/grafana/dashboards/Dashboard_10_Single_index_analysis.json deleted file mode 100644 index 5b221e2..0000000 --- a/config/grafana/dashboards/Dashboard_10_Single_index_analysis.json +++ /dev/null @@ -1,230 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "id": 10, - "links": [], - "panels": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Baseline Boguk ratio" - }, - "properties": [ - { - "id": "custom.lineStyle", - "value": { - "dash": [ - 10, - 10 - ], - "fill": "dash" - } - }, - { - "id": "color", - "value": { - "fixedColor": "dark-red", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Boguk ratio" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "green", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 18, - "w": 24, - "x": 0, - "y": 0 - }, - "id": 1, - "options": { - "legend": { - "calcs": [], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "pgwatch_pg_class_total_relation_size_bytes{relname=\"$index_name\", schemaname=\"$schema_name\"} / pgwatch_pg_class_reltuples{relname=\"$index_name\", schemaname=\"$schema_name\"}", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "", - "legendFormat": "Current Boguk ratio", - "range": true, - "refId": "A", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "editorMode": "code", - "expr": "pgwatch_pg_index_pilot_best_ratio{indexrelname=\"$index_name\", schemaname=\"$schema_name\"}", - "hide": false, - "instant": false, - "legendFormat": "Baseline Boguk ratio", - "range": true, - "refId": "B" - } - ], - "title": "", - "type": "timeseries" - } - ], - "preload": false, - "schemaVersion": 41, - "tags": [], - "templating": { - "list": [ - { - "current": { - "text": "test_pilot", - "value": "test_pilot" - }, - "definition": "label_values(pgwatch_pg_index_pilot_estimated_tuples,schemaname)", - "name": "schema_name", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(pgwatch_pg_index_pilot_estimated_tuples,schemaname)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "type": "query" - }, - { - "current": { - "text": "", - "value": "" - }, - "definition": "label_values(pgwatch_pg_index_pilot_estimated_tuples{schemaname=\"$schema_name\"},indexrelname)", - "name": "index_name", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(pgwatch_pg_index_pilot_estimated_tuples{schemaname=\"$schema_name\"},indexrelname)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "type": "query" - } - ] - }, - "time": { - "from": "now-1h", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "10. Single index analysis", - "uid": "aa0128c5-c5a0-4418-a99e-c941af10426e", - "version": 6 -} \ No newline at end of file diff --git a/config/grafana/dashboards/Dashboard_11_Single_index_analysis.json b/config/grafana/dashboards/Dashboard_11_Single_index_analysis.json new file mode 100644 index 0000000..48e5e89 --- /dev/null +++ b/config/grafana/dashboards/Dashboard_11_Single_index_analysis.json @@ -0,0 +1,331 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 14, + "links": [], + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "axisSoftMin": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Boguk ratio (index size / live tuples), baseline" + }, + "properties": [ + { + "id": "custom.lineStyle", + "value": { + "dash": [ + 10, + 10 + ], + "fill": "dash" + } + }, + { + "id": "color", + "value": { + "fixedColor": "dark-red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Boguk ratio (index size / live tuples), current" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "index_rebuild_scale_factor" + }, + "properties": [ + { + "id": "custom.lineWidth", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "pg_index_pilot rebuild threshold " + }, + "properties": [ + { + "id": "custom.lineStyle", + "value": { + "dash": [ + 10, + 10 + ], + "fill": "dash" + } + }, + { + "id": "color", + "value": { + "fixedColor": "dark-orange", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 18, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "pgwatch_pg_class_total_relation_size_bytes{relname=\"$index_name\", schemaname=\"$schema_name\"} / pgwatch_pg_class_reltuples{relname=\"$index_name\", schemaname=\"$schema_name\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "", + "legendFormat": "Boguk ratio (index size / live tuples), current", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "editorMode": "code", + "expr": "pgwatch_pg_index_pilot_best_ratio{indexrelname=\"$index_name\", schemaname=\"$schema_name\"}", + "hide": false, + "instant": false, + "legendFormat": "Boguk ratio (index size / live tuples), baseline", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "editorMode": "code", + "expr": "max by () (\n last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=~\"$schema_name\", indexrelname=~\"$index_name\", datname=~\"$datname\"}[1w]) * 8 or\n last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=~\"$schema_name\", indexrelname=~\"$index_name\", datname=\"*\"}[1w]) * 7 or\n last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=~\"$schema_name\", indexrelname=\"*\", datname=~\"$datname\"}[1w]) * 6 or\n last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=\"*\", indexrelname=~\"$index_name\", datname=~\"$datname\"}[1w]) * 5 or\n last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=\"*\", indexrelname=\"*\", datname=~\"$datname\"}[1w]) * 4 or\n last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=~\"$schema_name\", indexrelname=\"*\", datname=\"*\"}[1w]) * 3 or\n last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=\"*\", indexrelname=~\"$index_name\", datname=\"*\"}[1w]) * 2 or\n last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=\"*\", indexrelname=\"*\", datname=\"*\"}[1w]) * 1\n) / \nmax by () (\n 8 * (last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=~\"$schema_name\", indexrelname=~\"$index_name\", datname=~\"$datname\"}[1w]) * 0 + 1) or\n 7 * (last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=~\"$schema_name\", indexrelname=~\"$index_name\", datname=\"*\"}[1w]) * 0 + 1) or\n 6 * (last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=~\"$schema_name\", indexrelname=\"*\", datname=~\"$datname\"}[1w]) * 0 + 1) or\n 5 * (last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=\"*\", indexrelname=~\"$index_name\", datname=~\"$datname\"}[1w]) * 0 + 1) or\n 4 * (last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=\"*\", indexrelname=\"*\", datname=~\"$datname\"}[1w]) * 0 + 1) or\n 3 * (last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=~\"$schema_name\", indexrelname=\"*\", datname=\"*\"}[1w]) * 0 + 1) or\n 2 * (last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=\"*\", indexrelname=~\"$index_name\", datname=\"*\"}[1w]) * 0 + 1) or\n 1 * (last_over_time(pgwatch_pg_index_pilot_config_config_value_normalized{config_key=\"index_rebuild_scale_factor\", schemaname=\"*\", indexrelname=\"*\", datname=\"*\"}[1w]) * 0 + 1)\n)", + "hide": false, + "instant": false, + "legendFormat": "index_rebuild_scale_factor", + "range": true, + "refId": "C" + } + ], + "title": "", + "transformations": [ + { + "id": "calculateField", + "options": { + "alias": "pg_index_pilot rebuild threshold ", + "binary": { + "left": { + "matcher": { + "id": "byName", + "options": "Boguk ratio (index size / live tuples), baseline" + } + }, + "operator": "*", + "right": { + "matcher": { + "id": "byName", + "options": "index_rebuild_scale_factor" + } + } + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + } + ], + "type": "timeseries" + } + ], + "preload": false, + "schemaVersion": 41, + "tags": [], + "templating": { + "list": [ + { + "current": { + "text": "workloaddb", + "value": "workloaddb" + }, + "definition": "label_values(pgwatch_pg_index_pilot_best_ratio,datname)", + "label": "DB name", + "name": "datname", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(pgwatch_pg_index_pilot_best_ratio,datname)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "current": { + "text": "test_pilot", + "value": "test_pilot" + }, + "definition": "label_values(pgwatch_pg_index_pilot_estimated_tuples,schemaname)", + "name": "schema_name", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(pgwatch_pg_index_pilot_estimated_tuples,schemaname)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "current": { + "text": "items_email_idx", + "value": "items_email_idx" + }, + "definition": "label_values(pgwatch_pg_index_pilot_estimated_tuples{schemaname=\"$schema_name\"},indexrelname)", + "name": "index_name", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(pgwatch_pg_index_pilot_estimated_tuples{schemaname=\"$schema_name\"},indexrelname)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + } + ] + }, + "time": { + "from": "now-12h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "11. Single index analysis", + "uid": "aa0128c5-c5a0-4418-a99e-c941af10426e", + "version": 4 +} \ No newline at end of file diff --git a/config/grafana/dashboards/Dashboard_11_Single_table_analysis.json b/config/grafana/dashboards/Dashboard_11_Single_table_analysis.json deleted file mode 100644 index d61409f..0000000 --- a/config/grafana/dashboards/Dashboard_11_Single_table_analysis.json +++ /dev/null @@ -1,1222 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": 12, - "links": [], - "panels": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "bytes" - }, - "overrides": [] - }, - "gridPos": { - "h": 13, - "w": 24, - "x": 0, - "y": 0 - }, - "id": 34, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "disableTextWrap": false, - "editorMode": "builder", - "expr": "pgwatch_pg_class_total_relation_size_bytes{relkind=\"114\", schemaname=\"$schema_name\", relname=\"$table_name\"}", - "fullMetaSearch": false, - "includeNullMetadata": true, - "legendFormat": "{{schemaname}}.{{relname}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Table size", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "Bps" - }, - "overrides": [] - }, - "gridPos": { - "h": 13, - "w": 24, - "x": 0, - "y": 13 - }, - "id": 36, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "disableTextWrap": false, - "editorMode": "code", - "expr": "irate(pgwatch_pg_class_total_relation_size_bytes{relkind=\"114\", schemaname=\"$schema_name\", relname=\"$table_name\"}[$__rate_interval])", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "20", - "legendFormat": "{{schemaname}}.{{relname}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Table size change rate", - "type": "timeseries" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 26 - }, - "id": 31, - "panels": [], - "title": "Bloat stats", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "bytes" - }, - "overrides": [] - }, - "gridPos": { - "h": 13, - "w": 24, - "x": 0, - "y": 27 - }, - "id": 32, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Max", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "disableTextWrap": false, - "editorMode": "builder", - "expr": "pgwatch_pg_table_bloat_bloat_size{schemaname=\"$schema_name\", tblname=\"$table_name\"}", - "fullMetaSearch": false, - "includeNullMetadata": true, - "legendFormat": "{{schemaname}}.{{tblname}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Bloat size", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percent" - }, - "overrides": [] - }, - "gridPos": { - "h": 13, - "w": 24, - "x": 0, - "y": 40 - }, - "id": 33, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Mean", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "disableTextWrap": false, - "editorMode": "builder", - "expr": "pgwatch_pg_table_bloat_bloat_pct{schemaname=\"$schema_name\", tblname=\"$table_name\"}", - "fullMetaSearch": false, - "includeNullMetadata": true, - "legendFormat": "{{schemaname}}.{{tblname}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Bloat %", - "type": "timeseries" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 53 - }, - "id": 30, - "panels": [], - "title": "Tuple stats", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 100, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Inserts" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-green", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Deletes" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-red", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "HOT Updates" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "orange", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Non-HOT Updates" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "yellow", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 10, - "w": 24, - "x": 0, - "y": 54 - }, - "id": 21, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Max", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum by (node_name, table_full_name, dbname, cluster) (irate(pgwatch_table_stats_n_tup_ins{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "Inserts", - "range": true, - "refId": "A", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum by (node_name, table_full_name, dbname, cluster) (irate(pgwatch_table_stats_n_tup_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "Updates", - "range": true, - "refId": "B", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum by (node_name, table_full_name, dbname, cluster) (irate(pgwatch_table_stats_n_tup_hot_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "HOT Updates", - "range": true, - "refId": "C", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum by (node_name, table_full_name, dbname, cluster) (irate(pgwatch_table_stats_n_tup_del{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "Deletes", - "range": true, - "refId": "D", - "useBackend": false - } - ], - "title": "Tuple operations", - "transformations": [ - { - "id": "calculateField", - "options": { - "alias": "Non-HOT Updates", - "binary": { - "left": { - "matcher": { - "id": "byName", - "options": "Updates" - } - }, - "operator": "-", - "right": { - "matcher": { - "id": "byName", - "options": "HOT Updates" - } - } - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Updates": true - }, - "includeByName": {}, - "indexByName": {}, - "renameByName": { - "Hot Updates": "HOT Updates" - } - } - } - ], - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 100, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [ - { - "matcher": { - "id": "byFrameRefID", - "options": "A" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-green", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byFrameRefID", - "options": "B" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "orange", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byFrameRefID", - "options": "C" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "yellow", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byFrameRefID", - "options": "D" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-red", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 10, - "w": 24, - "x": 0, - "y": 64 - }, - "id": 37, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Max", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(irate(pgwatch_table_stats_n_tup_ins{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\", table_name=~\"$table_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "Inserts", - "range": true, - "refId": "A", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(irate(pgwatch_table_stats_n_tup_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\", table_name=~\"$table_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "Updates", - "range": true, - "refId": "B", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(irate(pgwatch_table_stats_n_tup_hot_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\", table_name=~\"$table_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "HOT Updates", - "range": true, - "refId": "C", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(irate(pgwatch_table_stats_n_tup_del{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\", table_name=~\"$table_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "Deletes", - "range": true, - "refId": "D", - "useBackend": false - } - ], - "title": "Tuple operations (%) (Aggregated)", - "transformations": [ - { - "id": "calculateField", - "options": { - "alias": "Non-HOT Updates", - "binary": { - "left": { - "matcher": { - "id": "byName", - "options": "Updates" - } - }, - "operator": "-", - "right": { - "matcher": { - "id": "byName", - "options": "HOT Updates" - } - } - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - } - } - }, - { - "id": "calculateField", - "options": { - "mode": "reduceRow", - "reduce": { - "include": [ - "Inserts", - "Deletes", - "Updates" - ], - "reducer": "sum" - } - } - }, - { - "id": "calculateField", - "options": { - "alias": "Inserts %", - "binary": { - "left": { - "matcher": { - "id": "byName", - "options": "Inserts" - } - }, - "operator": "/", - "right": { - "matcher": { - "id": "byName", - "options": "Total" - } - } - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - } - } - }, - { - "id": "calculateField", - "options": { - "alias": "Non-HOT-Updates %", - "binary": { - "left": { - "matcher": { - "id": "byName", - "options": "Non-HOT Updates" - } - }, - "operator": "/", - "right": { - "matcher": { - "id": "byName", - "options": "Total" - } - } - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - } - } - }, - { - "id": "calculateField", - "options": { - "alias": "HOT-Updates", - "binary": { - "left": { - "matcher": { - "id": "byName", - "options": "HOT Updates" - } - }, - "operator": "/", - "right": { - "matcher": { - "id": "byName", - "options": "Total" - } - } - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - } - } - }, - { - "id": "calculateField", - "options": { - "alias": "Deletes %", - "binary": { - "left": { - "matcher": { - "id": "byName", - "options": "Deletes" - } - }, - "operator": "/", - "right": { - "matcher": { - "id": "byName", - "options": "Total" - } - } - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Deletes": true, - "HOT Updates": true, - "Inserts": true, - "Non-HOT Updates": true, - "Total": true, - "Updates": true - }, - "includeByName": {}, - "indexByName": {}, - "renameByName": { - "Hot Updates": "HOT Updates" - } - } - } - ], - "type": "timeseries" - }, - { - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 24, - "x": 0, - "y": 74 - }, - "id": 20, - "options": { - "code": { - "language": "plaintext", - "showLineNumbers": false, - "showMiniMap": false - }, - "content": "

\n Brought to you by Postgres AI\n \"Postgres.AI\"\n

\n", - "mode": "html" - }, - "pluginVersion": "12.0.2", - "title": "", - "type": "text" - } - ], - "preload": false, - "schemaVersion": 41, - "tags": [], - "templating": { - "list": [ - { - "current": { - "text": "default", - "value": "default" - }, - "definition": "label_values(pgwatch_settings_configured,cluster)", - "label": "Cluster name", - "name": "cluster_name", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(pgwatch_settings_configured,cluster)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "type": "query" - }, - { - "current": { - "text": "postgres_ai", - "value": "postgres_ai" - }, - "definition": "label_values(pgwatch_settings_configured{cluster=\"$cluster_name\"},node_name)", - "label": "Node name", - "name": "node_name", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(pgwatch_settings_configured{cluster=\"$cluster_name\"},node_name)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "type": "query" - }, - { - "current": { - "text": "workloaddb", - "value": "workloaddb" - }, - "definition": "label_values(pgwatch_pg_database_wraparound_age_datfrozenxid{cluster=\"$cluster_name\", node_name=\"$node_name\", datname!=\"template1\"},datname)", - "label": "DB name", - "name": "db_name", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(pgwatch_pg_database_wraparound_age_datfrozenxid{cluster=\"$cluster_name\", node_name=\"$node_name\", datname!=\"template1\"},datname)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "type": "query" - }, - { - "current": { - "text": "test_pilot", - "value": "test_pilot" - }, - "definition": "label_values(pgwatch_table_stats_n_tup_ins,schema)", - "label": "Schema name", - "name": "schema_name", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(pgwatch_table_stats_n_tup_ins,schema)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "type": "query" - }, - { - "current": { - "text": "items", - "value": "items" - }, - "definition": "label_values(pgwatch_table_stats_n_tup_ins{schema=\"$schema_name\"},table_name)", - "label": "Table name", - "name": "table_name", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(pgwatch_table_stats_n_tup_ins{schema=\"$schema_name\"},table_name)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "type": "query" - } - ] - }, - "time": { - "from": "now-12h", - "to": "now" - }, - "timepicker": {}, - "timezone": "utc", - "title": "11. Single table analysis", - "uid": "11-single-table-analysis", - "version": 5 -} \ No newline at end of file diff --git a/config/grafana/dashboards/Dashboard_1_Node_performance_overview.json b/config/grafana/dashboards/Dashboard_1_Node_performance_overview.json index d97d0e8..9037e5f 100644 --- a/config/grafana/dashboards/Dashboard_1_Node_performance_overview.json +++ b/config/grafana/dashboards/Dashboard_1_Node_performance_overview.json @@ -18,7 +18,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 1, - "id": 8, + "id": 10, "links": [], "panels": [ { @@ -50,6 +50,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.5, "drawStyle": "bars", @@ -337,6 +338,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -553,6 +555,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -785,6 +788,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -887,6 +891,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -1026,6 +1031,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -1114,6 +1120,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -1258,6 +1265,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -1356,6 +1364,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -1458,6 +1467,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -1555,6 +1565,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -1652,6 +1663,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -1763,6 +1775,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -1874,6 +1887,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -1976,6 +1990,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -2078,6 +2093,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -2180,6 +2196,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -2282,6 +2299,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -2487,6 +2505,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -2692,6 +2711,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -2787,6 +2807,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -2889,6 +2910,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -2991,6 +3013,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -3196,6 +3219,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -3311,6 +3335,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -3426,6 +3451,268 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Inserts" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Deletes" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "HOT updates" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "orange", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Non-HOT updates" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "yellow", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 133 + }, + "id": 45, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Max", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum by (node_name, dbname, cluster) (irate(pgwatch_table_stats_n_tup_ins{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "Inserts", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum by (node_name, dbname, cluster) (irate(pgwatch_table_stats_n_tup_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "Updates", + "range": true, + "refId": "B", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum by (node_name, dbname, cluster) (irate(pgwatch_table_stats_n_tup_hot_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "HOT updates", + "range": true, + "refId": "C", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum by (node_name, dbname, cluster) (irate(pgwatch_table_stats_n_tup_del{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "Deletes", + "range": true, + "refId": "D", + "useBackend": false + } + ], + "title": "Tuple operations", + "transformations": [ + { + "id": "calculateField", + "options": { + "alias": "Non-HOT updates", + "binary": { + "left": { + "matcher": { + "id": "byName", + "options": "Updates" + } + }, + "operator": "-", + "right": { + "matcher": { + "id": "byName", + "options": "HOT updates" + } + } + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Updates": true + }, + "includeByName": {}, + "indexByName": {}, + "renameByName": { + "Hot Updates": "HOT Updates" + } + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.5, "drawStyle": "bars", @@ -3477,7 +3764,7 @@ "h": 8, "w": 12, "x": 0, - "y": 133 + "y": 146 }, "id": 32, "options": { @@ -3565,6 +3852,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -3613,7 +3901,7 @@ "h": 8, "w": 12, "x": 12, - "y": 133 + "y": 146 }, "id": 33, "options": { @@ -3663,6 +3951,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -3710,7 +3999,7 @@ "h": 8, "w": 12, "x": 0, - "y": 141 + "y": 154 }, "id": 34, "options": { @@ -3759,6 +4048,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -3806,7 +4096,7 @@ "h": 8, "w": 12, "x": 12, - "y": 141 + "y": 154 }, "id": 35, "options": { @@ -3855,6 +4145,7 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "axisSoftMin": 0, "barAlignment": 0, "barWidthFactor": 0.6, "drawStyle": "line", @@ -3903,7 +4194,7 @@ "h": 10, "w": 24, "x": 0, - "y": 149 + "y": 162 }, "id": 41, "options": { @@ -4065,7 +4356,7 @@ "h": 11, "w": 24, "x": 0, - "y": 159 + "y": 172 }, "id": 42, "options": { @@ -4101,6 +4392,202 @@ "title": "Vacuum timeline", "type": "timeseries" }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Total" + }, + "properties": [ + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "none" + } + }, + { + "id": "custom.fillOpacity", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 14, + "w": 24, + "x": 0, + "y": 183 + }, + "id": 44, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum(pgwatch_table_size_detailed_total_toast_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"})", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "TOAST", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(pgwatch_table_size_detailed_table_main_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"})", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Tables (w/o TOAST)", + "range": true, + "refId": "B", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum(pgwatch_table_size_detailed_table_indexes_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"})", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Indexes", + "range": true, + "refId": "C", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(pgwatch_table_size_detailed_table_vm_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"})", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Visibility maps", + "range": true, + "refId": "D", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(pgwatch_table_size_detailed_table_fsm_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"})", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Free space maps", + "range": true, + "refId": "E", + "useBackend": false + } + ], + "title": "DB logical size distribution", + "transformations": [ + { + "id": "calculateField", + "options": {} + } + ], + "type": "timeseries" + }, { "fieldConfig": { "defaults": {}, @@ -4110,7 +4597,7 @@ "h": 3, "w": 24, "x": 0, - "y": 170 + "y": 197 }, "id": 40, "options": { @@ -4119,7 +4606,7 @@ "showLineNumbers": false, "showMiniMap": false }, - "content": "

\n Brought to you by Postgres AI\n \"Postgres.AI\"\n

\n", + "content": "

\n Brought to you by PostgresAI\n \"Postgres.AI\"\n

\n", "mode": "html" }, "pluginVersion": "12.0.2", @@ -4152,8 +4639,8 @@ }, { "current": { - "text": "prod-db", - "value": "prod-db" + "text": "postgres_ai", + "value": "postgres_ai" }, "definition": "label_values(pgwatch_settings_configured{cluster=\"$cluster_name\"},node_name)", "label": "Node name", @@ -4170,8 +4657,8 @@ }, { "current": { - "text": "postgres", - "value": "postgres" + "text": "workloaddb", + "value": "workloaddb" }, "definition": "label_values(pgwatch_pg_database_wraparound_age_datfrozenxid{cluster=\"$cluster_name\", node_name=\"$node_name\", datname!=\"template1\"},datname)", "label": "DB name", @@ -4189,12 +4676,12 @@ ] }, "time": { - "from": "now-2d", + "from": "now-24h", "to": "now" }, "timepicker": {}, "timezone": "utc", "title": "01. Single node performance overview (high-level)", "uid": "f90500a0-a12e-4081-a2f0-07ed96f27915", - "version": 7 + "version": 24 } \ No newline at end of file diff --git a/config/grafana/dashboards/Dashboard_2_Aggregated_query_analysis.json b/config/grafana/dashboards/Dashboard_2_Aggregated_query_analysis.json index 0d54944..6f44cd5 100644 --- a/config/grafana/dashboards/Dashboard_2_Aggregated_query_analysis.json +++ b/config/grafana/dashboards/Dashboard_2_Aggregated_query_analysis.json @@ -467,6 +467,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -586,6 +587,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -704,6 +706,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -824,6 +827,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -942,6 +946,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -1062,6 +1067,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -1181,6 +1187,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -1300,6 +1307,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -1418,6 +1426,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -1538,6 +1547,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -1656,6 +1666,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -1776,6 +1787,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -1894,6 +1906,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -2014,6 +2027,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -2132,6 +2146,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -2252,6 +2267,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -2370,6 +2386,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -2488,6 +2505,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -2606,6 +2624,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -2723,6 +2742,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -2841,6 +2861,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -2959,6 +2980,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -3077,6 +3099,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -3196,7 +3219,7 @@ "showLineNumbers": false, "showMiniMap": false }, - "content": "

\n Brought to you by Postgres AI\n \"Postgres.AI\"\n

\n", + "content": "

\n Brought to you by PostgresAI\n \"Postgres.AI\"\n

\n", "mode": "html" }, "pluginVersion": "12.0.2", diff --git a/config/grafana/dashboards/Dashboard_3_Single_query_analysis.json b/config/grafana/dashboards/Dashboard_3_Single_query_analysis.json index 1417095..4dc2fab 100644 --- a/config/grafana/dashboards/Dashboard_3_Single_query_analysis.json +++ b/config/grafana/dashboards/Dashboard_3_Single_query_analysis.json @@ -119,6 +119,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.5, "drawStyle": "bars", "fillOpacity": 40, @@ -355,6 +356,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -474,6 +476,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -592,6 +595,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -712,6 +716,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -831,6 +836,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -950,6 +956,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -1068,6 +1075,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -1188,6 +1196,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -1306,6 +1315,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -1424,6 +1434,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -1541,6 +1552,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -1658,6 +1670,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -1776,6 +1789,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -1894,6 +1908,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -2012,6 +2027,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 100, @@ -2131,7 +2147,7 @@ "showLineNumbers": false, "showMiniMap": false }, - "content": "

\n Brought to you by Postgres AI\n \"Postgres.AI\"\n

\n", + "content": "

\n Brought to you by PostgresAI\n \"Postgres.AI\"\n

\n", "mode": "html" }, "pluginVersion": "12.0.2", diff --git a/config/grafana/dashboards/Dashboard_4_Wait_Sampling_Dashboard.json b/config/grafana/dashboards/Dashboard_4_Wait_Sampling_Dashboard.json index 30767a9..ededee7 100644 --- a/config/grafana/dashboards/Dashboard_4_Wait_Sampling_Dashboard.json +++ b/config/grafana/dashboards/Dashboard_4_Wait_Sampling_Dashboard.json @@ -38,6 +38,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.5, "drawStyle": "bars", "fillOpacity": 40, @@ -268,6 +269,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.5, "drawStyle": "bars", "fillOpacity": 40, @@ -472,6 +474,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.5, "drawStyle": "bars", "fillOpacity": 100, @@ -695,7 +698,7 @@ "showLineNumbers": false, "showMiniMap": false }, - "content": "

\n Brought to you by Postgres AI\n \"Postgres.AI\"\n

\n", + "content": "

\n Brought to you by PostgresAI\n \"Postgres.AI\"\n

\n", "mode": "html" }, "pluginVersion": "12.0.2", diff --git a/config/grafana/dashboards/Dashboard_5_Backup_stats.json b/config/grafana/dashboards/Dashboard_5_Backup_stats.json index e0558b5..71b8457 100644 --- a/config/grafana/dashboards/Dashboard_5_Backup_stats.json +++ b/config/grafana/dashboards/Dashboard_5_Backup_stats.json @@ -38,6 +38,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "bars", "fillOpacity": 100, @@ -192,6 +193,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -287,6 +289,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, @@ -390,7 +393,7 @@ "showLineNumbers": false, "showMiniMap": false }, - "content": "

\n Brought to you by Postgres AI\n \"Postgres.AI\"\n

\n", + "content": "

\n Brought to you by PostgresAI\n \"Postgres.AI\"\n

\n", "mode": "html" }, "pluginVersion": "12.0.2", diff --git a/config/grafana/dashboards/Dashboard_7_Autovacuum_and_bloat.json b/config/grafana/dashboards/Dashboard_7_Autovacuum_and_bloat.json index 21b981e..70e1226 100644 --- a/config/grafana/dashboards/Dashboard_7_Autovacuum_and_bloat.json +++ b/config/grafana/dashboards/Dashboard_7_Autovacuum_and_bloat.json @@ -40,6 +40,7 @@ "axisSoftMax": 7, "axisSoftMin": 1, "barAlignment": 0, + "axisSoftMin": 0, "barWidthFactor": 0.6, "drawStyle": "points", "fillOpacity": 0, diff --git a/config/grafana/dashboards/Dashboard_8_Table_Stats.json b/config/grafana/dashboards/Dashboard_8_Table_Stats.json new file mode 100644 index 0000000..29eba3a --- /dev/null +++ b/config/grafana/dashboards/Dashboard_8_Table_Stats.json @@ -0,0 +1,2938 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": 15, + "links": [], + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 27, + "panels": [], + "title": "Size stats", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 1, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, pgwatch_pg_class_total_relation_size_bytes{relkind=\"114\", schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"})", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by total size", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "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": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 7, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_pg_class_total_relation_size_bytes{relkind=\"114\", schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by size change rate (absolute)", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 0, + "y": 14 + }, + "id": 23, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "pgwatch_table_size_detailed_table_main_size_b{schema=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "{{schema}}.{{table_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by table (w/o TOAST) size", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "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": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 12, + "y": 14 + }, + "id": 24, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_table_size_detailed_table_main_size_b{schema=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schema}}.{{table_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by table (w/o TOAST) size change rate (absolute)", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 0, + "y": 27 + }, + "id": 28, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "pgwatch_table_size_detailed_toast_indexes_size_b{schema=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "{{schema}}.{{table_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by TOAST size", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "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": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 12, + "y": 27 + }, + "id": 29, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_table_size_detailed_total_toast_size_b{schema=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schema}}.{{table_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by TOAST size change rate (absolute)", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 0, + "y": 40 + }, + "id": 25, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, pgwatch_table_size_detailed_table_indexes_size_b\n{schema=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"})", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "{{schema}}.{{table_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by index size", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "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": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 12, + "y": 40 + }, + "id": 26, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_table_size_detailed_table_indexes_size_b{schema=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schema}}.{{table_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by index size change rate (absolute)", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 53 + }, + "id": 22, + "panels": [], + "title": "Estimated bloat stats", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": 100, + "axisSoftMin": 0, + "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": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 0, + "y": 54 + }, + "id": 8, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, pgwatch_pg_table_bloat_bloat_pct{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"})", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "{{schemaname}}.{{tblname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by estimated heap bloat %", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 12, + "y": 54 + }, + "id": 2, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, pgwatch_pg_table_bloat_bloat_size{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"})", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "{{schemaname}}.{{tblname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by estimated heap bloat size", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 67 + }, + "id": 11, + "panels": [], + "title": "Tuple stats", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 68 + }, + "id": 3, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, sum by(schema, table_name, table_full_name) (irate(pgwatch_table_stats_n_tup_ins{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval])))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "{{table_full_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by tuple inserts per second", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "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": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "links": [ + { + "title": "Table details", + "url": "/https/github.com/d/9-single-table-analysis/9-single-table-analysis?orgId=1&var-cluster_name=${cluster_name}&var-node_name=${node_name}&var-db_name=${db_name}&var-schema_name=${__field.labels.schema}&var-table_name=${__field.labels.table_name}" + } + ], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 68 + }, + "id": 5, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, sum by(schema, table_name, table_full_name) (irate(pgwatch_table_stats_n_tup_del{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval])))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "{{table_full_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by tuple deletes per second", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "links": [ + { + "title": "Table details", + "url": "/https/github.com/d/9-single-table-analysis/9-single-table-analysis?orgId=1&var-cluster_name=${cluster_name}&var-node_name=${node_name}&var-db_name=${db_name}&var-schema_name=${__field.labels.schema}&var-table_name=${__field.labels.table_name}" + } + ], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 78 + }, + "id": 6, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, sum by(schema, table_name, table_full_name) (irate(pgwatch_table_stats_n_tup_hot_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval])))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "{{table_full_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by tuple HOT updates per second", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "links": [ + { + "title": "Table details", + "url": "/https/github.com/d/9-single-table-analysis/9-single-table-analysis?orgId=1&var-cluster_name=${cluster_name}&var-node_name=${node_name}&var-db_name=${db_name}&var-schema_name=${__field.labels.schema}&var-table_name=${__field.labels.table_name}" + } + ], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 78 + }, + "id": 10, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, sum by(schema, table_name, table_full_name) (irate(pgwatch_table_stats_n_tup_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval]) - irate(pgwatch_table_stats_n_tup_hot_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval])))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "{{table_full_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by tuple non-HOT updates per second", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 88 + }, + "id": 40, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_pg_stat_user_tables_seq_tup_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by sequential reads of live tuples", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 101 + }, + "id": 41, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_pg_stat_user_tables_idx_tup_fetch{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by index fetches of live tuples", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 114 + }, + "id": 30, + "panels": [], + "title": "IO stats", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 0, + "y": 115 + }, + "id": 31, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, \n irate(pgwatch_pg_statio_all_tables_heap_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval])\n) * on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by total shared block hits", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "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": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "noValue": "-", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 12, + "y": 115 + }, + "id": 42, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, \n (irate(pgwatch_pg_statio_all_tables_heap_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))/(irate(pgwatch_pg_statio_all_tables_heap_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + (irate(pgwatch_pg_statio_all_tables_heap_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))) \n) ", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by total shared block hit ratio", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 0, + "y": 128 + }, + "id": 37, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_pg_statio_all_tables_heap_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \nirate(pgwatch_pg_statio_all_tables_idx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \nirate(pgwatch_pg_statio_all_tables_toast_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \nirate(pgwatch_pg_statio_all_tables_tidx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval])) * on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by total shared block reads", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "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": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "noValue": "-", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 12, + "y": 128 + }, + "id": 43, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, \n (irate(pgwatch_pg_statio_all_tables_heap_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))/(irate(pgwatch_pg_statio_all_tables_heap_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + (irate(pgwatch_pg_statio_all_tables_heap_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))) \n) ", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by total shared block read ratio", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 141 + }, + "id": 36, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_pg_statio_all_tables_heap_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))* on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by table (without TOAST) shared block hits", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 154 + }, + "id": 32, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_pg_statio_all_tables_heap_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by table (without TOAST) shared block reads", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 167 + }, + "id": 38, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_pg_statio_all_tables_toast_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))* on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by TOAST shared block hits", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 180 + }, + "id": 39, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_pg_statio_all_tables_toast_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by TOAST shared block reads", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 193 + }, + "id": 33, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_pg_statio_all_tables_idx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval])) * on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by index shared block hits", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 206 + }, + "id": 34, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "topk($top_n, irate(pgwatch_pg_statio_all_tables_idx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))* on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "{{schemaname}}.{{relname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Top $top_n tables by index shared block reads", + "type": "timeseries" + }, + { + "fieldConfig": { + "defaults": {}, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 24, + "x": 0, + "y": 219 + }, + "id": 20, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "

\n Brought to you by PostgresAI\n \"Postgres.AI\"\n

\n", + "mode": "html" + }, + "pluginVersion": "12.0.2", + "title": "", + "type": "text" + } + ], + "preload": false, + "schemaVersion": 41, + "tags": [], + "templating": { + "list": [ + { + "current": { + "text": "default", + "value": "default" + }, + "definition": "label_values(pgwatch_settings_configured,cluster)", + "label": "Cluster name", + "name": "cluster_name", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(pgwatch_settings_configured,cluster)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "current": { + "text": "postgres_ai", + "value": "postgres_ai" + }, + "definition": "label_values(pgwatch_settings_configured{cluster=\"$cluster_name\"},node_name)", + "label": "Node name", + "name": "node_name", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(pgwatch_settings_configured{cluster=\"$cluster_name\"},node_name)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "current": { + "text": "workloaddb", + "value": "workloaddb" + }, + "definition": "label_values(pgwatch_pg_database_wraparound_age_datfrozenxid{cluster=\"$cluster_name\", node_name=\"$node_name\", datname!=\"template1\"},datname)", + "label": "DB name", + "name": "db_name", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(pgwatch_pg_database_wraparound_age_datfrozenxid{cluster=\"$cluster_name\", node_name=\"$node_name\", datname!=\"template1\"},datname)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "current": { + "text": "test_pilot", + "value": "test_pilot" + }, + "definition": "label_values(pgwatch_pg_class_relation_size_bytes,schemaname)", + "includeAll": true, + "label": "Schema name", + "name": "schema_name", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(pgwatch_pg_class_relation_size_bytes,schemaname)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "current": { + "text": "10", + "value": "10" + }, + "label": "Top N tables", + "name": "top_n", + "options": [ + { + "selected": false, + "text": "5", + "value": "5" + }, + { + "selected": true, + "text": "10", + "value": "10" + }, + { + "selected": false, + "text": "15", + "value": "15" + }, + { + "selected": false, + "text": "20", + "value": "20" + } + ], + "query": "5,10,15,20", + "type": "custom" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "utc", + "title": "08. Aggregated table analysis", + "uid": "92657f2a-985b-4d1a-99ed-2fac6e0c53e2", + "version": 97 +} \ No newline at end of file diff --git a/config/grafana/dashboards/Dashboard_9_Single_table_analysis.json b/config/grafana/dashboards/Dashboard_9_Single_table_analysis.json new file mode 100644 index 0000000..5600409 --- /dev/null +++ b/config/grafana/dashboards/Dashboard_9_Single_table_analysis.json @@ -0,0 +1,2050 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": 16, + "links": [], + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 27, + "panels": [], + "title": "Size stats", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Total" + }, + "properties": [ + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "none" + } + }, + { + "id": "custom.fillOpacity", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 38, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "pgwatch_table_size_detailed_total_toast_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "TOAST", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum(pgwatch_table_size_detailed_table_main_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"})", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Table (w/o TOAST)", + "range": true, + "refId": "B", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum(pgwatch_table_size_detailed_table_indexes_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"})", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Indexes", + "range": true, + "refId": "C", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum(pgwatch_table_size_detailed_table_vm_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"})", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Visibility map", + "range": true, + "refId": "D", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum(pgwatch_table_size_detailed_table_fsm_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"})", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Free space map", + "range": true, + "refId": "E", + "useBackend": false + } + ], + "title": "Table logical size distribution", + "transformations": [ + { + "id": "calculateField", + "options": {} + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "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": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Total" + }, + "properties": [ + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "none" + } + }, + { + "id": "custom.fillOpacity", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 39, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "irate(pgwatch_table_size_detailed_total_toast_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "TOAST", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "irate(pgwatch_table_size_detailed_table_main_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval])", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "interval": "20", + "legendFormat": "Table (w/o TOAST)", + "range": true, + "refId": "B", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "irate(pgwatch_table_size_detailed_table_indexes_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval])", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "interval": "20", + "legendFormat": "Indexes", + "range": true, + "refId": "C", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "irate(pgwatch_table_size_detailed_table_vm_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval])", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "interval": "20", + "legendFormat": "Visibility map", + "range": true, + "refId": "D", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "irate(pgwatch_table_size_detailed_table_fsm_size_b{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval])", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "interval": "20", + "legendFormat": "Free space map", + "range": true, + "refId": "E", + "useBackend": false + } + ], + "title": "Table logical size distribution changes (absolute)", + "transformations": [ + { + "id": "calculateField", + "options": {} + } + ], + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 14 + }, + "id": 31, + "panels": [], + "title": "Estimated bloat stats", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": 100, + "axisSoftMin": 0, + "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": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 0, + "y": 15 + }, + "id": 33, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "pgwatch_pg_table_bloat_bloat_pct{schemaname=\"$schema_name\", tblname=\"$table_name\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "{{schemaname}}.{{tblname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Estimated bloat %", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 12, + "y": 15 + }, + "id": 32, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Max", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "pgwatch_pg_table_bloat_bloat_size{schemaname=\"$schema_name\", tblname=\"$table_name\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "{{schemaname}}.{{tblname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Estimated bloat size", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 28 + }, + "id": 30, + "panels": [], + "title": "Tuple stats", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Inserts" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Deletes" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "HOT updates" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "orange", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Non-HOT updates" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "yellow", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 29 + }, + "id": 21, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Max", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum by (node_name, table_full_name, dbname, cluster) (irate(pgwatch_table_stats_n_tup_ins{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "Inserts", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum by (node_name, table_full_name, dbname, cluster) (irate(pgwatch_table_stats_n_tup_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "Updates", + "range": true, + "refId": "B", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum by (node_name, table_full_name, dbname, cluster) (irate(pgwatch_table_stats_n_tup_hot_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "HOT updates", + "range": true, + "refId": "C", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum by (node_name, table_full_name, dbname, cluster) (irate(pgwatch_table_stats_n_tup_del{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=\"$schema_name\", table_name=\"$table_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "Deletes", + "range": true, + "refId": "D", + "useBackend": false + } + ], + "title": "Tuple operations", + "transformations": [ + { + "id": "calculateField", + "options": { + "alias": "Non-HOT updates", + "binary": { + "left": { + "matcher": { + "id": "byName", + "options": "Updates" + } + }, + "operator": "-", + "right": { + "matcher": { + "id": "byName", + "options": "HOT updates" + } + } + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Updates": true + }, + "includeByName": {}, + "indexByName": {}, + "renameByName": { + "Hot Updates": "HOT Updates" + } + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Inserts %" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Non-HOT-Updates %" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "yellow", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "HOT-Updates" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "orange", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Deletes %" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-red", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 29 + }, + "id": 37, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Max", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum(irate(pgwatch_table_stats_n_tup_ins{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\", table_name=~\"$table_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "Inserts", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum(irate(pgwatch_table_stats_n_tup_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\", table_name=~\"$table_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "Updates", + "range": true, + "refId": "B", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum(irate(pgwatch_table_stats_n_tup_hot_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\", table_name=~\"$table_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "HOT Updates", + "range": true, + "refId": "C", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum(irate(pgwatch_table_stats_n_tup_del{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\", table_name=~\"$table_name\"}[$__rate_interval]))", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "interval": "60", + "legendFormat": "Deletes", + "range": true, + "refId": "D", + "useBackend": false + } + ], + "title": "Tuple operations (%)", + "transformations": [ + { + "id": "calculateField", + "options": { + "alias": "Non-HOT Updates", + "binary": { + "left": { + "matcher": { + "id": "byName", + "options": "Updates" + } + }, + "operator": "-", + "right": { + "matcher": { + "id": "byName", + "options": "HOT Updates" + } + } + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "mode": "reduceRow", + "reduce": { + "include": [ + "Inserts", + "Deletes", + "Updates" + ], + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "Inserts %", + "binary": { + "left": { + "matcher": { + "id": "byName", + "options": "Inserts" + } + }, + "operator": "/", + "right": { + "matcher": { + "id": "byName", + "options": "Total" + } + } + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "Non-HOT-Updates %", + "binary": { + "left": { + "matcher": { + "id": "byName", + "options": "Non-HOT Updates" + } + }, + "operator": "/", + "right": { + "matcher": { + "id": "byName", + "options": "Total" + } + } + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "HOT-Updates", + "binary": { + "left": { + "matcher": { + "id": "byName", + "options": "HOT Updates" + } + }, + "operator": "/", + "right": { + "matcher": { + "id": "byName", + "options": "Total" + } + } + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "Deletes %", + "binary": { + "left": { + "matcher": { + "id": "byName", + "options": "Deletes" + } + }, + "operator": "/", + "right": { + "matcher": { + "id": "byName", + "options": "Total" + } + } + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Deletes": true, + "HOT Updates": true, + "Inserts": true, + "Non-HOT Updates": true, + "Total": true, + "Updates": true + }, + "includeByName": {}, + "indexByName": {}, + "renameByName": { + "Hot Updates": "HOT Updates" + } + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 24, + "x": 0, + "y": 39 + }, + "id": 42, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "irate(pgwatch_pg_stat_user_tables_seq_tup_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "Fetched by sequential scans", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "irate(pgwatch_pg_stat_user_tables_idx_tup_fetch{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval])", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "Fetched by index scans", + "range": true, + "refId": "B", + "useBackend": false + } + ], + "title": "Live tuples fetch distribution", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 49 + }, + "id": 43, + "panels": [], + "title": "IO stats", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Total" + }, + "properties": [ + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "none" + } + }, + { + "id": "custom.fillOpacity", + "value": 0 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 50 + }, + "id": 44, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "editorMode": "code", + "expr": "irate(pgwatch_pg_statio_all_tables_heap_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) * on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "hide": false, + "instant": false, + "interval": "20", + "legendFormat": "Heap", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "editorMode": "code", + "expr": "irate(pgwatch_pg_statio_all_tables_idx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) * on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "hide": false, + "instant": false, + "interval": "20", + "legendFormat": "Index", + "range": true, + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "editorMode": "code", + "expr": "irate(pgwatch_pg_statio_all_tables_toast_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) * on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "hide": false, + "instant": false, + "interval": "20", + "legendFormat": "TOAST", + "range": true, + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "editorMode": "code", + "expr": "irate(pgwatch_pg_statio_all_tables_tidx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) * on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "hide": false, + "instant": false, + "interval": "20", + "legendFormat": "TOAST indexes", + "range": true, + "refId": "E" + } + ], + "title": "Shared block hits", + "transformations": [ + { + "id": "calculateField", + "options": {} + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Total" + }, + "properties": [ + { + "id": "custom.stacking", + "value": { + "group": "A", + "mode": "none" + } + }, + { + "id": "custom.fillOpacity", + "value": 0 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 13, + "w": 24, + "x": 0, + "y": 63 + }, + "id": 45, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "editorMode": "code", + "expr": "irate(pgwatch_pg_statio_all_tables_heap_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) * on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "hide": false, + "instant": false, + "interval": "20", + "legendFormat": "Heap", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "editorMode": "code", + "expr": "irate(pgwatch_pg_statio_all_tables_idx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) * on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "hide": false, + "instant": false, + "interval": "20", + "legendFormat": "Index", + "range": true, + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "editorMode": "code", + "expr": "irate(pgwatch_pg_statio_all_tables_toast_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) * on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "hide": false, + "instant": false, + "interval": "20", + "legendFormat": "TOAST", + "range": true, + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "editorMode": "code", + "expr": "irate(pgwatch_pg_statio_all_tables_tidx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) * on() group_left() last_over_time(pgwatch_settings_numeric_value{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", setting_name=\"block_size\"}[1d])", + "hide": false, + "instant": false, + "interval": "20", + "legendFormat": "TOAST indexes", + "range": true, + "refId": "E" + } + ], + "title": "Shared block reads", + "transformations": [ + { + "id": "calculateField", + "options": {} + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMax": 1, + "axisSoftMin": 0, + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "noValue": "-", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 14, + "w": 24, + "x": 0, + "y": 76 + }, + "id": 46, + "options": { + "legend": { + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.0.2", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "\n (irate(pgwatch_pg_statio_all_tables_heap_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]))/(irate(pgwatch_pg_statio_all_tables_heap_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + (irate(pgwatch_pg_statio_all_tables_heap_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval])))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "20", + "legendFormat": "Shared blocks hit", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "P7A0D6631BB10B34F" + }, + "editorMode": "code", + "expr": "\n (irate(pgwatch_pg_statio_all_tables_heap_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]))/(irate(pgwatch_pg_statio_all_tables_heap_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_read{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + (irate(pgwatch_pg_statio_all_tables_heap_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_idx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_toast_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval]) + \n irate(pgwatch_pg_statio_all_tables_tidx_blks_hit{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", relname=\"$table_name\"}[$__rate_interval])))", + "hide": false, + "instant": false, + "interval": "20", + "legendFormat": "Shared blocks read", + "range": true, + "refId": "B" + } + ], + "title": "Shared block hit ratio", + "type": "timeseries" + }, + { + "fieldConfig": { + "defaults": {}, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 24, + "x": 0, + "y": 90 + }, + "id": 20, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "

\n Brought to you by PostgresAI\n \"Postgres.AI\"\n

\n", + "mode": "html" + }, + "pluginVersion": "12.0.2", + "title": "", + "type": "text" + } + ], + "preload": false, + "schemaVersion": 41, + "tags": [], + "templating": { + "list": [ + { + "current": { + "text": "default", + "value": "default" + }, + "definition": "label_values(pgwatch_settings_configured,cluster)", + "label": "Cluster name", + "name": "cluster_name", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(pgwatch_settings_configured,cluster)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "current": { + "text": "postgres_ai", + "value": "postgres_ai" + }, + "definition": "label_values(pgwatch_settings_configured{cluster=\"$cluster_name\"},node_name)", + "label": "Node name", + "name": "node_name", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(pgwatch_settings_configured{cluster=\"$cluster_name\"},node_name)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "current": { + "text": "workloaddb", + "value": "workloaddb" + }, + "definition": "label_values(pgwatch_pg_database_wraparound_age_datfrozenxid{cluster=\"$cluster_name\", node_name=\"$node_name\", datname!=\"template1\"},datname)", + "label": "DB name", + "name": "db_name", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(pgwatch_pg_database_wraparound_age_datfrozenxid{cluster=\"$cluster_name\", node_name=\"$node_name\", datname!=\"template1\"},datname)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "current": { + "text": "test_pilot", + "value": "test_pilot" + }, + "definition": "label_values(pgwatch_table_stats_n_tup_ins,schema)", + "label": "Schema name", + "name": "schema_name", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(pgwatch_table_stats_n_tup_ins,schema)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "current": { + "text": "items", + "value": "items" + }, + "definition": "label_values(pgwatch_table_stats_n_tup_ins{schema=\"$schema_name\"},table_name)", + "label": "Table name", + "name": "table_name", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(pgwatch_table_stats_n_tup_ins{schema=\"$schema_name\"},table_name)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "utc", + "title": "09. Single table analysis", + "uid": "9-single-table-analysis", + "version": 43 +} \ No newline at end of file diff --git a/config/grafana/dashboards/Dashboard_9_Table_Stats.json b/config/grafana/dashboards/Dashboard_9_Table_Stats.json deleted file mode 100644 index d194fd9..0000000 --- a/config/grafana/dashboards/Dashboard_9_Table_Stats.json +++ /dev/null @@ -1,1789 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 1, - "id": 15, - "links": [], - "panels": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "bytes" - }, - "overrides": [] - }, - "gridPos": { - "h": 13, - "w": 12, - "x": 0, - "y": 0 - }, - "id": 1, - "options": { - "legend": { - "calcs": [ - "last" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Last", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "disableTextWrap": false, - "editorMode": "code", - "expr": "topk($top_n, pgwatch_pg_class_total_relation_size_bytes{relkind=\"114\", schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"})", - "fullMetaSearch": false, - "includeNullMetadata": true, - "legendFormat": "{{schemaname}}.{{relname}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Top $top_n tables by size", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "Bps" - }, - "overrides": [] - }, - "gridPos": { - "h": 13, - "w": 12, - "x": 12, - "y": 0 - }, - "id": 7, - "options": { - "legend": { - "calcs": [ - "last" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Last", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "disableTextWrap": false, - "editorMode": "code", - "expr": "topk($top_n, irate(pgwatch_pg_class_total_relation_size_bytes{relkind=\"114\", schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "20", - "legendFormat": "{{schemaname}}.{{relname}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Top $top_n tables by size change rate", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percent" - }, - "overrides": [] - }, - "gridPos": { - "h": 13, - "w": 12, - "x": 0, - "y": 13 - }, - "id": 8, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Mean", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "disableTextWrap": false, - "editorMode": "code", - "expr": "topk($top_n, pgwatch_pg_table_bloat_bloat_pct{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"})", - "fullMetaSearch": false, - "includeNullMetadata": true, - "legendFormat": "{{schemaname}}.{{tblname}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Top $top_n tables by bloat %", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "bytes" - }, - "overrides": [] - }, - "gridPos": { - "h": 13, - "w": 12, - "x": 12, - "y": 13 - }, - "id": 2, - "options": { - "legend": { - "calcs": [ - "last" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Last", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "disableTextWrap": false, - "editorMode": "code", - "expr": "topk($top_n, pgwatch_pg_table_bloat_bloat_size{schemaname=~\"$schema_name\", datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\"})", - "fullMetaSearch": false, - "includeNullMetadata": true, - "legendFormat": "{{schemaname}}.{{tblname}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Top $top_n tables by bloat size", - "type": "timeseries" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 26 - }, - "id": 11, - "panels": [], - "title": "Tuple stats", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 100, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [ - { - "matcher": { - "id": "byFrameRefID", - "options": "A" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-green", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byFrameRefID", - "options": "B" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "orange", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byFrameRefID", - "options": "C" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "yellow", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byFrameRefID", - "options": "D" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-red", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 10, - "w": 24, - "x": 0, - "y": 27 - }, - "id": 12, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Max", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(irate(pgwatch_table_stats_n_tup_ins{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "Inserts", - "range": true, - "refId": "A", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(irate(pgwatch_table_stats_n_tup_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "Updates", - "range": true, - "refId": "B", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(irate(pgwatch_table_stats_n_tup_hot_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "HOT Updates", - "range": true, - "refId": "C", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(irate(pgwatch_table_stats_n_tup_del{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "Deletes", - "range": true, - "refId": "D", - "useBackend": false - } - ], - "title": "Tuple operations (aggregated)", - "transformations": [ - { - "id": "calculateField", - "options": { - "alias": "Non-HOT Updates", - "binary": { - "left": { - "matcher": { - "id": "byName", - "options": "Updates" - } - }, - "operator": "-", - "right": { - "matcher": { - "id": "byName", - "options": "HOT Updates" - } - } - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Updates": true - }, - "includeByName": {}, - "indexByName": {}, - "renameByName": { - "Hot Updates": "HOT Updates" - } - } - } - ], - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 100, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [ - { - "matcher": { - "id": "byFrameRefID", - "options": "A" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-green", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byFrameRefID", - "options": "B" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "orange", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byFrameRefID", - "options": "C" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "yellow", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byFrameRefID", - "options": "D" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-red", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 10, - "w": 24, - "x": 0, - "y": 37 - }, - "id": 21, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Max", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(irate(pgwatch_table_stats_n_tup_ins{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "Inserts", - "range": true, - "refId": "A", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(irate(pgwatch_table_stats_n_tup_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "Updates", - "range": true, - "refId": "B", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(irate(pgwatch_table_stats_n_tup_hot_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "HOT Updates", - "range": true, - "refId": "C", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(irate(pgwatch_table_stats_n_tup_del{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval]))", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "Deletes", - "range": true, - "refId": "D", - "useBackend": false - } - ], - "title": "Tuple operations (%) (Aggregated)", - "transformations": [ - { - "id": "calculateField", - "options": { - "alias": "Non-HOT Updates", - "binary": { - "left": { - "matcher": { - "id": "byName", - "options": "Updates" - } - }, - "operator": "-", - "right": { - "matcher": { - "id": "byName", - "options": "HOT Updates" - } - } - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - } - } - }, - { - "id": "calculateField", - "options": { - "mode": "reduceRow", - "reduce": { - "include": [ - "Inserts", - "Deletes", - "Updates" - ], - "reducer": "sum" - } - } - }, - { - "id": "calculateField", - "options": { - "alias": "Inserts %", - "binary": { - "left": { - "matcher": { - "id": "byName", - "options": "Inserts" - } - }, - "operator": "/", - "right": { - "matcher": { - "id": "byName", - "options": "Total" - } - } - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - } - } - }, - { - "id": "calculateField", - "options": { - "alias": "Non-HOT-Updates %", - "binary": { - "left": { - "matcher": { - "id": "byName", - "options": "Non-HOT Updates" - } - }, - "operator": "/", - "right": { - "matcher": { - "id": "byName", - "options": "Total" - } - } - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - } - } - }, - { - "id": "calculateField", - "options": { - "alias": "HOT-Updates", - "binary": { - "left": { - "matcher": { - "id": "byName", - "options": "HOT Updates" - } - }, - "operator": "/", - "right": { - "matcher": { - "id": "byName", - "options": "Total" - } - } - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - } - } - }, - { - "id": "calculateField", - "options": { - "alias": "Deletes %", - "binary": { - "left": { - "matcher": { - "id": "byName", - "options": "Deletes" - } - }, - "operator": "/", - "right": { - "matcher": { - "id": "byName", - "options": "Total" - } - } - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Deletes": true, - "HOT Updates": true, - "Inserts": true, - "Non-HOT Updates": true, - "Total": true, - "Updates": true - }, - "includeByName": {}, - "indexByName": {}, - "renameByName": { - "Hot Updates": "HOT Updates" - } - } - } - ], - "type": "timeseries" - }, - { - "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": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 0, - "y": 47 - }, - "id": 3, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Mean", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "topk($top_n, sum by(schema, table_name, table_full_name) (irate(pgwatch_table_stats_n_tup_ins{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval])))", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "{{table_full_name}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Top $top_n tables by inserts/sec", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "links": [ - { - "title": "Table details", - "url": "/https/github.com/d/11-single-table-analysis/11-single-table-analysis?orgId=1&var-cluster_name=${cluster_name}&var-node_name=${node_name}&var-db_name=${db_name}&var-schema_name=${__field.labels.schema}&var-table_name=${__field.labels.table_name}" - } - ], - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 12, - "y": 47 - }, - "id": 4, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Mean", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "topk($top_n, sum by(schema, table_name, table_full_name) (irate(pgwatch_table_stats_n_tup_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval])))", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "{{table_full_name}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Top $top_n tables by updates/sec", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "links": [ - { - "title": "Table details", - "url": "/https/github.com/d/11-single-table-analysis/11-single-table-analysis?orgId=1&var-cluster_name=${cluster_name}&var-node_name=${node_name}&var-db_name=${db_name}&var-schema_name=${__field.labels.schema}&var-table_name=${__field.labels.table_name}" - } - ], - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 0, - "y": 57 - }, - "id": 5, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Mean", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "topk($top_n, sum by(schema, table_name, table_full_name) (irate(pgwatch_table_stats_n_tup_del{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval])))", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "{{table_full_name}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Top $top_n tables by deletes/sec", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "links": [ - { - "title": "Table details", - "url": "/https/github.com/d/11-single-table-analysis/11-single-table-analysis?orgId=1&var-cluster_name=${cluster_name}&var-node_name=${node_name}&var-db_name=${db_name}&var-schema_name=${__field.labels.schema}&var-table_name=${__field.labels.table_name}" - } - ], - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 12, - "y": 57 - }, - "id": 6, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Mean", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "topk($top_n, sum by(schema, table_name, table_full_name) (irate(pgwatch_table_stats_n_tup_hot_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval])))", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "{{table_full_name}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Top $top_n tables by HOT updates/sec", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "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": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "links": [ - { - "title": "Table details", - "url": "/https/github.com/d/11-single-table-analysis/11-single-table-analysis?orgId=1&var-cluster_name=${cluster_name}&var-node_name=${node_name}&var-db_name=${db_name}&var-schema_name=${__field.labels.schema}&var-table_name=${__field.labels.table_name}" - } - ], - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "ops" - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 0, - "y": 67 - }, - "id": 10, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Mean", - "sortDesc": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "P7A0D6631BB10B34F" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "topk($top_n, sum by(schema, table_name, table_full_name) (irate(pgwatch_table_stats_n_tup_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval]) - irate(pgwatch_table_stats_n_tup_hot_upd{datname=\"$db_name\", cluster=\"$cluster_name\", node_name=\"$node_name\", schema=~\"$schema_name\"}[$__rate_interval])))", - "fullMetaSearch": false, - "includeNullMetadata": true, - "interval": "60", - "legendFormat": "{{table_full_name}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Top $top_n tables by Non-HOT updates/sec", - "type": "timeseries" - }, - { - "fieldConfig": { - "defaults": {}, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 24, - "x": 0, - "y": 77 - }, - "id": 20, - "options": { - "code": { - "language": "plaintext", - "showLineNumbers": false, - "showMiniMap": false - }, - "content": "

\n Brought to you by Postgres AI\n \"Postgres.AI\"\n

\n", - "mode": "html" - }, - "pluginVersion": "12.0.2", - "title": "", - "type": "text" - } - ], - "preload": false, - "schemaVersion": 41, - "tags": [], - "templating": { - "list": [ - { - "current": { - "text": "default", - "value": "default" - }, - "definition": "label_values(pgwatch_settings_configured,cluster)", - "label": "Cluster name", - "name": "cluster_name", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(pgwatch_settings_configured,cluster)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "type": "query" - }, - { - "current": { - "text": "5.78.159.160", - "value": "5.78.159.160" - }, - "definition": "label_values(pgwatch_settings_configured{cluster=\"$cluster_name\"},node_name)", - "label": "Node name", - "name": "node_name", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(pgwatch_settings_configured{cluster=\"$cluster_name\"},node_name)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "type": "query" - }, - { - "current": { - "text": "postgres", - "value": "postgres" - }, - "definition": "label_values(pgwatch_pg_database_wraparound_age_datfrozenxid{cluster=\"$cluster_name\", node_name=\"$node_name\", datname!=\"template1\"},datname)", - "label": "DB name", - "name": "db_name", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(pgwatch_pg_database_wraparound_age_datfrozenxid{cluster=\"$cluster_name\", node_name=\"$node_name\", datname!=\"template1\"},datname)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "type": "query" - }, - { - "current": { - "text": "All", - "value": "$__all" - }, - "definition": "label_values(pgwatch_pg_class_relation_size_bytes,schemaname)", - "includeAll": true, - "label": "Schema name", - "name": "schema_name", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(pgwatch_pg_class_relation_size_bytes,schemaname)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, - "refresh": 1, - "regex": "", - "type": "query" - }, - { - "current": { - "text": "10", - "value": "10" - }, - "label": "Top N tables", - "name": "top_n", - "options": [ - { - "selected": false, - "text": "5", - "value": "5" - }, - { - "selected": true, - "text": "10", - "value": "10" - }, - { - "selected": false, - "text": "15", - "value": "15" - }, - { - "selected": false, - "text": "20", - "value": "20" - } - ], - "query": "5,10,15,20", - "type": "custom" - } - ] - }, - "time": { - "from": "now-12h", - "to": "now" - }, - "timepicker": {}, - "timezone": "utc", - "title": "09. Top tables overview", - "uid": "92657f2a-985b-4d1a-99ed-2fac6e0c53e2", - "version": 10 - } \ No newline at end of file diff --git a/config/pgwatch-prometheus/metrics.yml b/config/pgwatch-prometheus/metrics.yml index 46b062e..52654f4 100644 --- a/config/pgwatch-prometheus/metrics.yml +++ b/config/pgwatch-prometheus/metrics.yml @@ -285,7 +285,7 @@ metrics: from pg_locks where - pid != pg_backend_pid() + pid <> pg_backend_pid() and database = (select oid from pg_database where datname = current_database()) limit 5000 ) @@ -368,7 +368,7 @@ metrics: category as tag_category, vartype as tag_vartype, case when setting ~ '^-?[0-9]+$' then setting::bigint else null end as numeric_value, - case when source != 'default' then 0 else 1 end as is_default, + case when source <> 'default' then 0 else 1 end as is_default, 1 as configured from pg_settings gauges: @@ -390,7 +390,7 @@ metrics: from pg_class c join pg_namespace n on n.oid = c.relnamespace where relkind in ('p', 'r') - and relpersistence != 't' + and relpersistence <> 't' and not n.nspname like any (array[E'pg\\_%', 'information_schema', E'\\_timescaledb%']) and not exists(select * from pg_inherits where inhrelid = c.oid) and exists(select * from pg_inherits where inhparent = c.oid) @@ -414,7 +414,7 @@ metrics: pg_table_size(relid) as table_size_b, abs(greatest(ceil(log((pg_table_size(relid) + 1) / 10 ^ 6)), 0))::text as tag_table_size_cardinality_mb, -- i.e. 0=<1MB, 1=<10MB, 2=<100MB,.. pg_total_relation_size(relid) as total_relation_size_b, - case when reltoastrelid != 0 then pg_total_relation_size(reltoastrelid) else 0::int8 end as toast_size_b, + case when reltoastrelid <> 0 then pg_total_relation_size(reltoastrelid) else 0::int8 end as toast_size_b, (extract(epoch from now() - greatest(last_vacuum, last_autovacuum)))::int8 as seconds_since_last_vacuum, (extract(epoch from now() - greatest(last_analyze, last_autoanalyze)))::int8 as seconds_since_last_analyze, case when 'autovacuum_enabled=off' = ANY (c.reloptions) then 1 else 0 end as no_autovacuum, @@ -432,14 +432,14 @@ metrics: autovacuum_count, analyze_count, autoanalyze_count, - case when c.relkind != 'p' then age(c.relfrozenxid) else 0 end as tx_freeze_age + case when c.relkind <> 'p' then age(c.relfrozenxid) else 0 end as tx_freeze_age from pg_stat_user_tables ut join pg_class c on c.oid = ut.relid where -- leaving out fully locked tables as pg_relation_size also wants a lock and would wait not exists(select 1 from pg_locks where relation = relid and mode = 'AccessExclusiveLock') - and c.relpersistence != 't' -- and temp tables + and c.relpersistence <> 't' -- and temp tables ) select /* pgwatch_generated */ @@ -526,7 +526,7 @@ metrics: from pg_class c join pg_namespace n on n.oid = c.relnamespace where relkind in ('p', 'r') - and relpersistence != 't' + and relpersistence <> 't' and not n.nspname like any (array[E'pg\\_%', 'information_schema', E'\\_timescaledb%']) and not exists(select * from pg_inherits where inhrelid = c.oid) and exists(select * from pg_inherits where inhparent = c.oid) @@ -550,7 +550,7 @@ metrics: pg_table_size(relid) as table_size_b, abs(greatest(ceil(log((pg_table_size(relid) + 1) / 10 ^ 6)), 0))::text as tag_table_size_cardinality_mb, -- i.e. 0=<1MB, 1=<10MB, 2=<100MB,.. pg_total_relation_size(relid) as total_relation_size_b, - case when c.reltoastrelid != 0 then pg_total_relation_size(c.reltoastrelid) else 0::int8 end as toast_size_b, + case when c.reltoastrelid <> 0 then pg_total_relation_size(c.reltoastrelid) else 0::int8 end as toast_size_b, (extract(epoch from now() - greatest(last_vacuum, last_autovacuum)))::int8 as seconds_since_last_vacuum, (extract(epoch from now() - greatest(last_analyze, last_autoanalyze)))::int8 as seconds_since_last_analyze, case when 'autovacuum_enabled=off' = ANY (c.reloptions) then 1 else 0 end as no_autovacuum, @@ -568,7 +568,7 @@ metrics: autovacuum_count, analyze_count, autoanalyze_count, - case when c.relkind != 'p' then age(c.relfrozenxid) else 0 end as tx_freeze_age, + case when c.relkind <> 'p' then age(c.relfrozenxid) else 0 end as tx_freeze_age, extract(epoch from now() - last_seq_scan)::int8 as last_seq_scan_s from pg_stat_user_tables ut join pg_class c on c.oid = ut.relid @@ -578,7 +578,7 @@ metrics: where -- leaving out fully locked tables as pg_relation_size also wants a lock and would wait not exists (select 1 from pg_locks where relation = relid and mode = 'AccessExclusiveLock') - and c.relpersistence != 't' -- and temp tables + and c.relpersistence <> 't' -- and temp tables order by case when c.relkind = 'p' then 1e9::int else coalesce(c.relpages, 0) + coalesce(t.relpages, 0) + coalesce(tir.relpages, 0) end desc limit 1500 /* NB! When changing the bottom final LIMIT also adjust this limit. Should be at least 5x bigger as approx sizes depend a lot on vacuum frequency. The general idea is to reduce filesystem "stat"-ing on tables that won't make it to final output anyways based on approximate size */ @@ -1315,6 +1315,76 @@ metrics: - is_na - reltuples statement_timeout_seconds: 300 + table_size_detailed: + description: > + This metric provides comprehensive table size analysis including the actual table size (main data fork only), + TOAST table size, index size, free space map (FSM) size, and visibility map (VM) size. + It helps administrators understand detailed storage breakdown for each table component. + sqls: + 11: |- + with table_sizes as ( + select + (extract(epoch from now()) * 1e9)::int8 as epoch_ns, + current_database() as tag_datname, + n.nspname as tag_schema, + c.relname as tag_table_name, + c.oid as table_oid, + c.reltoastrelid, + -- Main table size components (bytes) + pg_relation_size(c.oid, 'main') as table_main_size_b, + pg_relation_size(c.oid, 'fsm') as table_fsm_size_b, + pg_relation_size(c.oid, 'vm') as table_vm_size_b, + pg_indexes_size(c.oid) as table_indexes_size_b, + pg_relation_size(c.reltoastrelid, 'main') as toast_main_size_b, + pg_relation_size(c.reltoastrelid, 'fsm') as toast_fsm_size_b, + pg_relation_size(c.reltoastrelid, 'vm') as toast_vm_size_b, + pg_indexes_size(c.reltoastrelid) as toast_indexes_size_b, + pg_total_relation_size(c.reltoastrelid) as toast_total_size_b, + pg_total_relation_size(c.oid) as total_relation_size_b, + abs(greatest(ceil(log((pg_total_relation_size(c.oid) + 1) / 10 ^ 6)), 0))::text as tag_size_cardinality_mb + from pg_class c + join pg_namespace n on n.oid = c.relnamespace + where c.relkind in ('r', 'p', 'm') -- regular tables, partitioned tables, materialized views + and n.nspname not in ('information_schema', 'pg_toast') + and not exists ( + select 1 from pg_locks + where relation = c.oid and mode = 'AccessExclusiveLock' + ) + order by pg_total_relation_size(c.oid) desc + ) + select /* pgwatch_generated */ + epoch_ns, + tag_datname, + tag_schema, + tag_table_name, + tag_size_cardinality_mb, + table_main_size_b, + table_fsm_size_b, + table_vm_size_b, + table_indexes_size_b, + toast_main_size_b, + toast_fsm_size_b, + toast_vm_size_b, + toast_indexes_size_b, + total_relation_size_b, + (toast_main_size_b + toast_fsm_size_b + toast_vm_size_b + toast_indexes_size_b) as total_toast_size_b + from table_sizes + where total_relation_size_b > 0 + gauges: + - table_main_size_b + - table_fsm_size_b + - table_vm_size_b + - table_indexes_size_b + - toast_main_size_b + - toast_fsm_size_b + - toast_vm_size_b + - toast_indexes_size_b + - total_relation_size_b + - actual_data_size_b + - metadata_size_b + - total_indexes_size_b + - total_toast_size_b + statement_timeout_seconds: 15 pg_invalid_indexes: description: > This metric identifies invalid indexes in the database. @@ -1962,6 +2032,68 @@ metrics: - is_valid - estimated_tuples - best_ratio + + pg_index_pilot_config: + sqls: + 12: | + select + coalesce(datname, '*') as tag_datname, + coalesce(schemaname, '*') as tag_schemaname, + coalesce(relname, '*') as tag_relname, + coalesce(indexrelname, '*') as tag_indexrelname, + key as tag_config_key, + case + when key = 'index_size_threshold' then + case + when value ~ '^[0-9]+MB$' then (regexp_replace(value, 'MB$', '')::numeric * 1024 * 1024)::float + when value ~ '^[0-9]+kB$' then (regexp_replace(value, 'kB$', '')::numeric * 1024)::float + when value ~ '^[0-9]+GB$' then (regexp_replace(value, 'GB$', '')::numeric * 1024 * 1024 * 1024)::float + else 0 + end + when key = 'minimum_reliable_index_size' then + case + when value ~ '^[0-9]+kB$' then (regexp_replace(value, 'kB$', '')::numeric * 1024)::float + when value ~ '^[0-9]+MB$' then (regexp_replace(value, 'MB$', '')::numeric * 1024 * 1024)::float + else 0 + end + when key = 'index_rebuild_scale_factor' then value::float + when key = 'reindex_history_retention_period' then + case when value ~ 'years?' then regexp_replace(value, ' years?', '')::int else 0 end + when key = 'skip' then case when value::boolean then 1 else 0 end + else 0 + end as config_value_normalized, + value as tag_config_value_raw + from index_pilot.config + order by id; + gauges: + - config_value_normalized + + pg_statio_all_tables: + description: > + Retrieves table-level I/O statistics from the PostgreSQL `pg_statio_all_tables` view, providing insights into I/O operations for all tables. + It returns block-level read and hit statistics for heap, index, TOAST, and TOAST index operations broken down by schema and table. + This metric helps administrators monitor table-level I/O performance and identify which tables are generating the most I/O activity. + Compatible with all PostgreSQL versions. + sqls: + 11: |- + select /* pgwatch_generated */ + (extract(epoch from now()) * 1e9)::int8 as epoch_ns, + current_database() as tag_datname, + schemaname as tag_schemaname, + relname as tag_relname, + heap_blks_read, + heap_blks_hit, + idx_blks_read, + idx_blks_hit, + toast_blks_read, + toast_blks_hit, + tidx_blks_read, + tidx_blks_hit + from + pg_statio_all_tables + gauges: + - '*' + presets: full: @@ -1986,6 +2118,7 @@ presets: pg_stat_user_indexes: 30 pg_stat_statements: 30 pg_stat_replication: 30 + pg_statio_all_tables: 30 pg_total_relation_size: 30 pg_blocked: 30 pg_long_running_transactions: 30 @@ -1994,6 +2127,7 @@ presets: pg_database_wraparound: 30 pg_xlog_position: 30 pg_table_bloat: 7200 + table_size_detailed: 30 pg_btree_bloat: 7200 pg_invalid_indexes: 7200 redundant_indexes: 10800 @@ -2003,4 +2137,5 @@ presets: pg_vacuum_progress: 30 pg_index_pilot: metrics: - pg_index_pilot: 30 \ No newline at end of file + pg_index_pilot: 30 + pg_index_pilot_config: 7200 \ No newline at end of file diff --git a/flask-backend/app.py b/flask-backend/app.py index 4279530..9580158 100644 --- a/flask-backend/app.py +++ b/flask-backend/app.py @@ -484,10 +484,11 @@ def get_btree_bloat_csv(): logger.error(f"Error processing btree bloat request: {e}") return jsonify({"error": str(e)}), 500 -@app.route('/table_bloat/csv', methods=['GET']) -def get_table_bloat_csv(): +@app.route('/table_info/csv', methods=['GET']) +def get_table_info_csv(): """ - Get the most recent pg_table_bloat metrics as a CSV table. + Get comprehensive table information including bloat metrics, detailed size information, and I/O statistics as a CSV table. + Combines pg_table_bloat, table_size_detailed, and pg_statio_all_tables metrics for complete table analysis. """ try: # Get query parameters @@ -513,7 +514,9 @@ def get_table_bloat_csv(): filter_str = '{' + ','.join(filters) + '}' if filters else '' # Metrics to fetch with last_over_time to get only the most recent value + # Include bloat metrics, detailed size metrics, and I/O metrics metric_queries = [ + # Bloat metrics f'last_over_time(pgwatch_pg_table_bloat_real_size_mib{filter_str}[1d])', f'last_over_time(pgwatch_pg_table_bloat_extra_size{filter_str}[1d])', f'last_over_time(pgwatch_pg_table_bloat_extra_pct{filter_str}[1d])', @@ -521,6 +524,26 @@ def get_table_bloat_csv(): f'last_over_time(pgwatch_pg_table_bloat_bloat_size{filter_str}[1d])', f'last_over_time(pgwatch_pg_table_bloat_bloat_pct{filter_str}[1d])', f'last_over_time(pgwatch_pg_table_bloat_is_na{filter_str}[1d])', + # Detailed size metrics + f'last_over_time(pgwatch_table_size_detailed_table_main_size_b{filter_str}[1d])', + f'last_over_time(pgwatch_table_size_detailed_table_fsm_size_b{filter_str}[1d])', + f'last_over_time(pgwatch_table_size_detailed_table_vm_size_b{filter_str}[1d])', + f'last_over_time(pgwatch_table_size_detailed_table_indexes_size_b{filter_str}[1d])', + f'last_over_time(pgwatch_table_size_detailed_toast_main_size_b{filter_str}[1d])', + f'last_over_time(pgwatch_table_size_detailed_toast_fsm_size_b{filter_str}[1d])', + f'last_over_time(pgwatch_table_size_detailed_toast_vm_size_b{filter_str}[1d])', + f'last_over_time(pgwatch_table_size_detailed_toast_indexes_size_b{filter_str}[1d])', + f'last_over_time(pgwatch_table_size_detailed_total_relation_size_b{filter_str}[1d])', + f'last_over_time(pgwatch_table_size_detailed_total_toast_size_b{filter_str}[1d])', + # I/O metrics + f'last_over_time(pgwatch_pg_statio_all_tables_heap_blks_read{filter_str}[1d])', + f'last_over_time(pgwatch_pg_statio_all_tables_heap_blks_hit{filter_str}[1d])', + f'last_over_time(pgwatch_pg_statio_all_tables_idx_blks_read{filter_str}[1d])', + f'last_over_time(pgwatch_pg_statio_all_tables_idx_blks_hit{filter_str}[1d])', + f'last_over_time(pgwatch_pg_statio_all_tables_toast_blks_read{filter_str}[1d])', + f'last_over_time(pgwatch_pg_statio_all_tables_toast_blks_hit{filter_str}[1d])', + f'last_over_time(pgwatch_pg_statio_all_tables_tidx_blks_read{filter_str}[1d])', + f'last_over_time(pgwatch_pg_statio_all_tables_tidx_blks_hit{filter_str}[1d])', ] prom = get_prometheus_client() @@ -542,30 +565,114 @@ def get_table_bloat_csv(): 'schemaname': metric_labels.get('schemaname', ''), 'tblname': metric_labels.get('tblname', ''), } + value = float(entry['value'][1]) + + # Bloat metrics if 'real_size_mib' in query: - metric_results[key]['real_size_mib'] = float(entry['value'][1]) + metric_results[key]['real_size_mib'] = value elif 'extra_size' in query and 'extra_pct' not in query: - metric_results[key]['extra_size'] = float(entry['value'][1]) + metric_results[key]['extra_size'] = value elif 'extra_pct' in query: - metric_results[key]['extra_pct'] = float(entry['value'][1]) + metric_results[key]['extra_pct'] = value elif 'fillfactor' in query: - metric_results[key]['fillfactor'] = float(entry['value'][1]) + metric_results[key]['fillfactor'] = value elif 'bloat_size' in query: - metric_results[key]['bloat_size'] = float(entry['value'][1]) + metric_results[key]['bloat_size'] = value elif 'bloat_pct' in query: - metric_results[key]['bloat_pct'] = float(entry['value'][1]) + metric_results[key]['bloat_pct'] = value elif 'is_na' in query: - metric_results[key]['is_na'] = int(float(entry['value'][1])) + metric_results[key]['is_na'] = int(value) + + # Size metrics (convert bytes to MiB for consistency) + elif 'table_main_size_b' in query: + metric_results[key]['table_main_size_mib'] = value / (1024 * 1024) + elif 'table_fsm_size_b' in query: + metric_results[key]['table_fsm_size_mib'] = value / (1024 * 1024) + elif 'table_vm_size_b' in query: + metric_results[key]['table_vm_size_mib'] = value / (1024 * 1024) + elif 'table_indexes_size_b' in query: + metric_results[key]['table_indexes_size_mib'] = value / (1024 * 1024) + elif 'toast_main_size_b' in query: + metric_results[key]['toast_main_size_mib'] = value / (1024 * 1024) + elif 'toast_fsm_size_b' in query: + metric_results[key]['toast_fsm_size_mib'] = value / (1024 * 1024) + elif 'toast_vm_size_b' in query: + metric_results[key]['toast_vm_size_mib'] = value / (1024 * 1024) + elif 'toast_indexes_size_b' in query: + metric_results[key]['toast_indexes_size_mib'] = value / (1024 * 1024) + elif 'total_relation_size_b' in query: + metric_results[key]['total_relation_size_mib'] = value / (1024 * 1024) + elif 'total_toast_size_b' in query: + metric_results[key]['total_toast_size_mib'] = value / (1024 * 1024) + + # I/O metrics + elif 'heap_blks_read' in query: + metric_results[key]['heap_blks_read'] = int(value) + elif 'heap_blks_hit' in query: + metric_results[key]['heap_blks_hit'] = int(value) + elif 'idx_blks_read' in query: + metric_results[key]['idx_blks_read'] = int(value) + elif 'idx_blks_hit' in query: + metric_results[key]['idx_blks_hit'] = int(value) + elif 'toast_blks_read' in query: + metric_results[key]['toast_blks_read'] = int(value) + elif 'toast_blks_hit' in query: + metric_results[key]['toast_blks_hit'] = int(value) + elif 'tidx_blks_read' in query: + metric_results[key]['tidx_blks_read'] = int(value) + elif 'tidx_blks_hit' in query: + metric_results[key]['tidx_blks_hit'] = int(value) except Exception as e: logger.warning(f"Failed to query: {query}, error: {e}") continue + # Calculate I/O hit ratios + for key, row in metric_results.items(): + # Heap hit ratio + heap_total = row.get('heap_blks_read', 0) + row.get('heap_blks_hit', 0) + if heap_total > 0: + row['heap_hit_ratio'] = round(row.get('heap_blks_hit', 0) / heap_total * 100, 2) + else: + row['heap_hit_ratio'] = 0.0 + + # Index hit ratio + idx_total = row.get('idx_blks_read', 0) + row.get('idx_blks_hit', 0) + if idx_total > 0: + row['idx_hit_ratio'] = round(row.get('idx_blks_hit', 0) / idx_total * 100, 2) + else: + row['idx_hit_ratio'] = 0.0 + + # TOAST hit ratio + toast_total = row.get('toast_blks_read', 0) + row.get('toast_blks_hit', 0) + if toast_total > 0: + row['toast_hit_ratio'] = round(row.get('toast_blks_hit', 0) / toast_total * 100, 2) + else: + row['toast_hit_ratio'] = 0.0 + + # TOAST index hit ratio + tidx_total = row.get('tidx_blks_read', 0) + row.get('tidx_blks_hit', 0) + if tidx_total > 0: + row['tidx_hit_ratio'] = round(row.get('tidx_blks_hit', 0) / tidx_total * 100, 2) + else: + row['tidx_hit_ratio'] = 0.0 + # Prepare CSV output output = io.StringIO() fieldnames = [ 'database', 'schemaname', 'tblname', + # Bloat metrics 'real_size_mib', 'extra_size', 'extra_pct', 'fillfactor', - 'bloat_size', 'bloat_pct', 'is_na' + 'bloat_size', 'bloat_pct', 'is_na', + # Size metrics (all in MiB) + 'table_main_size_mib', 'table_fsm_size_mib', 'table_vm_size_mib', + 'table_indexes_size_mib', 'toast_main_size_mib', 'toast_fsm_size_mib', + 'toast_vm_size_mib', 'toast_indexes_size_mib', 'total_relation_size_mib', + 'total_toast_size_mib', + # I/O metrics + 'heap_blks_read', 'heap_blks_hit', 'heap_hit_ratio', + 'idx_blks_read', 'idx_blks_hit', 'idx_hit_ratio', + 'toast_blks_read', 'toast_blks_hit', 'toast_hit_ratio', + 'tidx_blks_read', 'tidx_blks_hit', 'tidx_hit_ratio' ] writer = csv.DictWriter(output, fieldnames=fieldnames) writer.writeheader() @@ -578,11 +685,11 @@ def get_table_bloat_csv(): # Create response response = make_response(csv_content) response.headers['Content-Type'] = 'text/csv' - response.headers['Content-Disposition'] = 'attachment; filename=table_bloat_latest.csv' + response.headers['Content-Disposition'] = 'attachment; filename=table_info_latest.csv' return response except Exception as e: - logger.error(f"Error processing table bloat request: {e}") + logger.error(f"Error processing table info request: {e}") return jsonify({"error": str(e)}), 500 if __name__ == '__main__':