From 7722894ea4fbfa5d8886855497a3969fecf06d18 Mon Sep 17 00:00:00 2001 From: Vonng Date: Sat, 7 Sep 2024 11:16:22 +0800 Subject: [PATCH] use monitor pg bloat view from pgcat dashboards --- files/grafana/pgsql/pgcat-database.json | 59 +- files/grafana/pgsql/pgcat-schema.json | 5586 ++++++++++++----------- 2 files changed, 2832 insertions(+), 2813 deletions(-) diff --git a/files/grafana/pgsql/pgcat-database.json b/files/grafana/pgsql/pgcat-database.json index fd354b6f..02c73dc2 100644 --- a/files/grafana/pgsql/pgcat-database.json +++ b/files/grafana/pgsql/pgcat-database.json @@ -2483,7 +2483,7 @@ }, { "datasource": { - "type": "postgres", + "type": "grafana-postgresql-datasource", "uid": "${dsn}" }, "description": "Schemas of current database ${datname}", @@ -2875,9 +2875,12 @@ "uid": "cc8a3615-9c82-44d7-be42-07d8aa1cac68" }, "editorMode": "code", + "expr": "", "format": "table", "group": [], + "legendFormat": "__auto", "metricColumn": "none", + "range": true, "rawQuery": true, "rawSql": "SELECT\n relnamespace AS \"OID\", nspname AS \"Schema\", nspowner::RegRole::TEXT AS \"Owner\",\n coalesce((data ->> 'r')::INTEGER, 0) AS \"r\",\n coalesce((data ->> 'i')::INTEGER, 0) AS \"i\",\n coalesce((data ->> 'S')::INTEGER, 0) AS \"S\",\n coalesce((data ->> 't')::INTEGER, 0) AS \"t\",\n coalesce((data ->> 'v')::INTEGER, 0) AS \"v\",\n coalesce((data ->> 'm')::INTEGER, 0) AS \"m\",\n coalesce((data ->> 'c')::INTEGER, 0) AS \"c\",\n coalesce((data ->> 'f')::INTEGER, 0) AS \"f\",\n coalesce((data ->> 'p')::INTEGER, 0) AS \"p\",\n coalesce((data ->> 'I')::INTEGER, 0) AS \"I\"\nFROM (\n SELECT relnamespace, json_object_agg(kind, count) AS data\n FROM (SELECT relnamespace, relkind::TEXT AS kind, count(*) AS count FROM pg_class GROUP BY relnamespace,relkind) d\n GROUP BY relnamespace\n ) j LEFT JOIN pg_namespace nsp ON j.relnamespace = nsp.oid\nWHERE nspname NOT IN ('pg_toast', 'information_schema', 'pg_catalog');", "refId": "A", @@ -7453,7 +7456,8 @@ "mode": "absolute", "steps": [ { - "color": "#346f36cc" + "color": "#346f36cc", + "value": null }, { "color": "red", @@ -7536,7 +7540,8 @@ "mode": "absolute", "steps": [ { - "color": "#3e668f" + "color": "#3e668f", + "value": null }, { "color": "#346f36cc", @@ -7601,7 +7606,8 @@ "mode": "absolute", "steps": [ { - "color": "#3e668f" + "color": "#3e668f", + "value": null }, { "color": "#346f36cc", @@ -7646,7 +7652,7 @@ "h": 12, "w": 12, "x": 0, - "y": 64 + "y": 27 }, "id": 190, "options": { @@ -7679,7 +7685,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT CURRENT_CATALOG AS datname, nspname || '.' || relname AS relname, tblid , bs * tblpages AS size,\n CASE WHEN tblpages - est_tblpages_ff > 0 THEN (tblpages - est_tblpages_ff)/tblpages::FLOAT ELSE 0 END AS ratio\nFROM (\n SELECT ceil( reltuples / ( (bs-page_hdr)*fillfactor/(tpl_size*100) ) ) + ceil( toasttuples / 4 ) AS est_tblpages_ff,\n tblpages, fillfactor, bs, tblid, nspname, relname, is_na\n FROM (\n SELECT\n ( 4 + tpl_hdr_size + tpl_data_size + (2 * ma)\n - CASE WHEN tpl_hdr_size % ma = 0 THEN ma ELSE tpl_hdr_size % ma END\n - CASE WHEN ceil(tpl_data_size)::INT % ma = 0 THEN ma ELSE ceil(tpl_data_size)::INT % ma END\n ) AS tpl_size, (heappages + toastpages) AS tblpages, heappages,\n toastpages, reltuples, toasttuples, bs, page_hdr, tblid, nspname, relname, fillfactor, is_na\n FROM (\n SELECT\n tbl.oid AS tblid, ns.nspname , tbl.relname, tbl.reltuples,\n tbl.relpages AS heappages, coalesce(toast.relpages, 0) AS toastpages,\n coalesce(toast.reltuples, 0) AS toasttuples,\n coalesce(substring(array_to_string(tbl.reloptions, ' ') FROM 'fillfactor=([0-9]+)')::smallint, 100) AS fillfactor,\n current_setting('block_size')::numeric AS bs,\n CASE WHEN version()~'mingw32' OR version()~'64-bit|x86_64|ppc64|ia64|amd64' THEN 8 ELSE 4 END AS ma,\n 24 AS page_hdr,\n 23 + CASE WHEN MAX(coalesce(s.null_frac,0)) > 0 THEN ( 7 + count(s.attname) ) / 8 ELSE 0::int END\n + CASE WHEN bool_or(att.attname = 'oid' and att.attnum < 0) THEN 4 ELSE 0 END AS tpl_hdr_size,\n sum( (1-coalesce(s.null_frac, 0)) * coalesce(s.avg_width, 0) ) AS tpl_data_size,\n bool_or(att.atttypid = 'pg_catalog.name'::regtype)\n OR sum(CASE WHEN att.attnum > 0 THEN 1 ELSE 0 END) <> count(s.attname) AS is_na\n FROM pg_attribute AS att\n JOIN pg_class AS tbl ON att.attrelid = tbl.oid\n JOIN pg_namespace AS ns ON ns.oid = tbl.relnamespace\n LEFT JOIN pg_stats AS s ON s.schemaname=ns.nspname AND s.tablename = tbl.relname AND s.inherited=false AND s.attname=att.attname\n LEFT JOIN pg_class AS toast ON tbl.reltoastrelid = toast.oid\n WHERE NOT att.attisdropped AND tbl.relkind = 'r' AND nspname NOT IN ('pg_catalog','information_schema')\n GROUP BY tbl.oid, ns.nspname, tbl.relname, tbl.reltuples, tbl.relpages, toast.relpages, toast.reltuples, tbl.reloptions\n ) AS s\n ) AS s2\n ) AS s3\nWHERE NOT is_na;", + "rawSql": "SELECT * FROM monitor.pg_table_bloat;", "refId": "A", "select": [ [ @@ -7769,7 +7775,8 @@ "mode": "absolute", "steps": [ { - "color": "#346f36cc" + "color": "#346f36cc", + "value": null } ] } @@ -7791,7 +7798,8 @@ "mode": "absolute", "steps": [ { - "color": "#3e668f" + "color": "#3e668f", + "value": null }, { "color": "#346f36cc", @@ -7830,7 +7838,8 @@ "mode": "absolute", "steps": [ { - "color": "#3e668f" + "color": "#3e668f", + "value": null }, { "color": "#346f36cc", @@ -7867,7 +7876,7 @@ "h": 12, "w": 12, "x": 12, - "y": 64 + "y": 27 }, "id": 191, "options": { @@ -7889,7 +7898,7 @@ "format": "table", "hide": false, "rawQuery": true, - "rawSql": "SELECT CURRENT_CATALOG AS datname, nspname, relname , tblid , bs * tblpages AS size,\n CASE WHEN tblpages - est_tblpages_ff > 0 THEN (tblpages - est_tblpages_ff)/tblpages::FLOAT ELSE 0 END AS ratio\nFROM (\n SELECT ceil( reltuples / ( (bs-page_hdr)*fillfactor/(tpl_size*100) ) ) + ceil( toasttuples / 4 ) AS est_tblpages_ff,\n tblpages, fillfactor, bs, tblid, nspname, relname, is_na\n FROM (\n SELECT\n ( 4 + tpl_hdr_size + tpl_data_size + (2 * ma)\n - CASE WHEN tpl_hdr_size % ma = 0 THEN ma ELSE tpl_hdr_size % ma END\n - CASE WHEN ceil(tpl_data_size)::INT % ma = 0 THEN ma ELSE ceil(tpl_data_size)::INT % ma END\n ) AS tpl_size, (heappages + toastpages) AS tblpages, heappages,\n toastpages, reltuples, toasttuples, bs, page_hdr, tblid, nspname, relname, fillfactor, is_na\n FROM (\n SELECT\n tbl.oid AS tblid, ns.nspname , tbl.relname, tbl.reltuples,\n tbl.relpages AS heappages, coalesce(toast.relpages, 0) AS toastpages,\n coalesce(toast.reltuples, 0) AS toasttuples,\n coalesce(substring(array_to_string(tbl.reloptions, ' ') FROM 'fillfactor=([0-9]+)')::smallint, 100) AS fillfactor,\n current_setting('block_size')::numeric AS bs,\n CASE WHEN version()~'mingw32' OR version()~'64-bit|x86_64|ppc64|ia64|amd64' THEN 8 ELSE 4 END AS ma,\n 24 AS page_hdr,\n 23 + CASE WHEN MAX(coalesce(s.null_frac,0)) > 0 THEN ( 7 + count(s.attname) ) / 8 ELSE 0::int END\n + CASE WHEN bool_or(att.attname = 'oid' and att.attnum < 0) THEN 4 ELSE 0 END AS tpl_hdr_size,\n sum( (1-coalesce(s.null_frac, 0)) * coalesce(s.avg_width, 0) ) AS tpl_data_size,\n bool_or(att.atttypid = 'pg_catalog.name'::regtype)\n OR sum(CASE WHEN att.attnum > 0 THEN 1 ELSE 0 END) <> count(s.attname) AS is_na\n FROM pg_attribute AS att\n JOIN pg_class AS tbl ON att.attrelid = tbl.oid\n JOIN pg_namespace AS ns ON ns.oid = tbl.relnamespace\n LEFT JOIN pg_stats AS s ON s.schemaname=ns.nspname AND s.tablename = tbl.relname AND s.inherited=false AND s.attname=att.attname\n LEFT JOIN pg_class AS toast ON tbl.reltoastrelid = toast.oid\n WHERE NOT att.attisdropped AND tbl.relkind = 'r' AND nspname NOT IN ('pg_catalog','information_schema')\n GROUP BY tbl.oid, ns.nspname, tbl.relname, tbl.reltuples, tbl.relpages, toast.relpages, toast.reltuples, tbl.reloptions\n ) AS s\n ) AS s2\n ) AS s3\nWHERE NOT is_na;", + "rawSql": "SELECT * FROM monitor.pg_table_bloat;", "refId": "A", "sql": { "columns": [ @@ -7962,7 +7971,8 @@ "mode": "absolute", "steps": [ { - "color": "#346f36cc" + "color": "#346f36cc", + "value": null }, { "color": "red", @@ -8045,7 +8055,8 @@ "mode": "absolute", "steps": [ { - "color": "#3e668f" + "color": "#3e668f", + "value": null }, { "color": "#346f36cc", @@ -8110,7 +8121,8 @@ "mode": "absolute", "steps": [ { - "color": "#3e668f" + "color": "#3e668f", + "value": null }, { "color": "#346f36cc", @@ -8143,7 +8155,7 @@ "h": 13, "w": 12, "x": 0, - "y": 76 + "y": 39 }, "id": 192, "options": { @@ -8176,7 +8188,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT CURRENT_CATALOG AS datname, nspname || '.' || idxname AS relname, tblid, idxid, relpages::BIGINT * bs AS size,\n COALESCE((relpages - ( reltuples * (6 + ma - (CASE WHEN index_tuple_hdr % ma = 0 THEN ma ELSE index_tuple_hdr % ma END)\n + nulldatawidth + ma - (CASE WHEN nulldatawidth % ma = 0 THEN ma ELSE nulldatawidth % ma END))\n / (bs - pagehdr)::FLOAT + 1 )), 0) / relpages::FLOAT AS ratio\nFROM (\n SELECT nspname,idxname,indrelid AS tblid,indexrelid AS idxid,\n reltuples,relpages,\n current_setting('block_size')::INTEGER AS bs,\n (CASE WHEN version() ~ 'mingw32' OR version() ~ '64-bit|x86_64|ppc64|ia64|amd64' THEN 8 ELSE 4 END) AS ma,\n 24 AS pagehdr,\n (CASE WHEN max(COALESCE(pg_stats.null_frac, 0)) = 0 THEN 2 ELSE 6 END) AS index_tuple_hdr,\n sum((1.0 - COALESCE(pg_stats.null_frac, 0.0)) *\n COALESCE(pg_stats.avg_width, 1024))::INTEGER AS nulldatawidth\n FROM pg_attribute\n JOIN (\n SELECT pg_namespace.nspname,\n ic.relname AS idxname,\n ic.reltuples,\n ic.relpages,\n pg_index.indrelid,\n pg_index.indexrelid,\n tc.relname AS tablename,\n regexp_split_to_table(pg_index.indkey::TEXT, ' ') :: INTEGER AS attnum,\n pg_index.indexrelid AS index_oid\n FROM pg_index\n JOIN pg_class ic ON pg_index.indexrelid = ic.oid\n JOIN pg_class tc ON pg_index.indrelid = tc.oid\n JOIN pg_namespace ON pg_namespace.oid = ic.relnamespace\n JOIN pg_am ON ic.relam = pg_am.oid\n WHERE pg_am.amname = 'btree' AND ic.relpages > 0 AND nspname NOT IN ('pg_catalog', 'information_schema')\n ) ind_atts ON pg_attribute.attrelid = ind_atts.indexrelid AND pg_attribute.attnum = ind_atts.attnum\n JOIN pg_stats ON pg_stats.schemaname = ind_atts.nspname\n AND ((pg_stats.tablename = ind_atts.tablename AND pg_stats.attname = pg_get_indexdef(pg_attribute.attrelid, pg_attribute.attnum, TRUE))\n OR (pg_stats.tablename = ind_atts.idxname AND pg_stats.attname = pg_attribute.attname))\n WHERE pg_attribute.attnum > 0\n GROUP BY nspname,idxname,indrelid,indexrelid,reltuples,relpages\n ) est;", + "rawSql": "SELECT * FROM monitor.pg_index_bloat;", "refId": "A", "select": [ [ @@ -8266,7 +8278,8 @@ "mode": "absolute", "steps": [ { - "color": "#346f36cc" + "color": "#346f36cc", + "value": null } ] } @@ -8288,7 +8301,8 @@ "mode": "absolute", "steps": [ { - "color": "#3e668f" + "color": "#3e668f", + "value": null }, { "color": "#346f36cc", @@ -8327,7 +8341,8 @@ "mode": "absolute", "steps": [ { - "color": "#3e668f" + "color": "#3e668f", + "value": null }, { "color": "#346f36cc", @@ -8364,7 +8379,7 @@ "h": 13, "w": 12, "x": 12, - "y": 76 + "y": 39 }, "id": 193, "options": { @@ -8387,7 +8402,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT CURRENT_CATALOG AS datname, nspname, idxname AS relname, tblid, idxid, relpages::BIGINT * bs AS size,\n COALESCE((relpages - ( reltuples * (6 + ma - (CASE WHEN index_tuple_hdr % ma = 0 THEN ma ELSE index_tuple_hdr % ma END)\n + nulldatawidth + ma - (CASE WHEN nulldatawidth % ma = 0 THEN ma ELSE nulldatawidth % ma END))\n / (bs - pagehdr)::FLOAT + 1 )), 0) / relpages::FLOAT AS ratio\nFROM (\n SELECT nspname,idxname,indrelid AS tblid,indexrelid AS idxid,\n reltuples,relpages,\n current_setting('block_size')::INTEGER AS bs,\n (CASE WHEN version() ~ 'mingw32' OR version() ~ '64-bit|x86_64|ppc64|ia64|amd64' THEN 8 ELSE 4 END) AS ma,\n 24 AS pagehdr,\n (CASE WHEN max(COALESCE(pg_stats.null_frac, 0)) = 0 THEN 2 ELSE 6 END) AS index_tuple_hdr,\n sum((1.0 - COALESCE(pg_stats.null_frac, 0.0)) *\n COALESCE(pg_stats.avg_width, 1024))::INTEGER AS nulldatawidth\n FROM pg_attribute\n JOIN (\n SELECT pg_namespace.nspname,\n ic.relname AS idxname,\n ic.reltuples,\n ic.relpages,\n pg_index.indrelid,\n pg_index.indexrelid,\n tc.relname AS tablename,\n regexp_split_to_table(pg_index.indkey::TEXT, ' ') :: INTEGER AS attnum,\n pg_index.indexrelid AS index_oid\n FROM pg_index\n JOIN pg_class ic ON pg_index.indexrelid = ic.oid\n JOIN pg_class tc ON pg_index.indrelid = tc.oid\n JOIN pg_namespace ON pg_namespace.oid = ic.relnamespace\n JOIN pg_am ON ic.relam = pg_am.oid\n WHERE pg_am.amname = 'btree' AND ic.relpages > 0 AND nspname NOT IN ('pg_catalog', 'information_schema')\n ) ind_atts ON pg_attribute.attrelid = ind_atts.indexrelid AND pg_attribute.attnum = ind_atts.attnum\n JOIN pg_stats ON pg_stats.schemaname = ind_atts.nspname\n AND ((pg_stats.tablename = ind_atts.tablename AND pg_stats.attname = pg_get_indexdef(pg_attribute.attrelid, pg_attribute.attnum, TRUE))\n OR (pg_stats.tablename = ind_atts.idxname AND pg_stats.attname = pg_attribute.attname))\n WHERE pg_attribute.attnum > 0\n GROUP BY nspname,idxname,indrelid,indexrelid,reltuples,relpages\n ) est;", + "rawSql": "SELECT * FROM monitor.pg_index_bloat;", "refId": "A", "select": [ [ @@ -15060,7 +15075,7 @@ "name": "dsn", "options": [], "query": "postgres", - "queryValue": "meta", + "queryValue": "", "refresh": 1, "regex": "/.*\\..*/", "skipUrlSync": false, diff --git a/files/grafana/pgsql/pgcat-schema.json b/files/grafana/pgsql/pgcat-schema.json index dcc0f3d4..c6221aef 100644 --- a/files/grafana/pgsql/pgcat-schema.json +++ b/files/grafana/pgsql/pgcat-schema.json @@ -2154,7 +2154,7 @@ "type": "table" }, { - "collapsed": false, + "collapsed": true, "datasource": { "type": "prometheus", "uid": "ds-prometheus" @@ -2166,2997 +2166,3001 @@ "y": 22 }, "id": 152, - "panels": [], - "title": "Table", - "type": "row" - }, - { - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "${dsn}" - }, - "description": "Tables of current database ${datname}", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "#3e668f", - "mode": "thresholds" - }, - "custom": { - "align": "center", - "cellOptions": { - "type": "color-text" - }, - "inspect": false + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${dsn}" }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "#e3e3e3e0", - "value": null + "description": "Tables of current database ${datname}", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "#3e668f", + "mode": "thresholds" + }, + "custom": { + "align": "center", + "cellOptions": { + "type": "color-text" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#e3e3e3e0", + "value": null + } + ] } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Schema" }, - "properties": [ - { - "id": "links", - "value": [] - }, + "overrides": [ { - "id": "mappings", - "value": [ + "matcher": { + "id": "byName", + "options": "Schema" + }, + "properties": [ { - "options": { - "monitor": { - "color": "#cc4637d9", - "index": 1 - }, - "public": { - "color": "#3e668f", - "index": 0 + "id": "links", + "value": [] + }, + { + "id": "mappings", + "value": [ + { + "options": { + "monitor": { + "color": "#cc4637d9", + "index": 1 + }, + "public": { + "color": "#3e668f", + "index": 0 + }, + "repack": { + "color": "#cc4637d9", + "index": 2 + } + }, + "type": "value" }, - "repack": { - "color": "#cc4637d9", - "index": 2 + { + "options": { + "pattern": "_.*", + "result": { + "color": "#f5a673", + "index": 3 + } + }, + "type": "regex" } - }, - "type": "value" + ] }, { - "options": { - "pattern": "_.*", - "result": { - "color": "#f5a673", - "index": 3 - } - }, - "type": "regex" + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "color", + "value": { + "fixedColor": "#3e668f", + "mode": "fixed" + } + }, + { + "id": "links", + "value": [] + }, + { + "id": "custom.minWidth", + "value": 180 + }, + { + "id": "custom.width", + "value": 200 } ] }, { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } + "matcher": { + "id": "byName", + "options": "Name" + }, + "properties": [ + { + "id": "custom.align", + "value": "left" + }, + { + "id": "custom.cellOptions", + "value": { + "type": "auto" + } + }, + { + "id": "custom.minWidth", + "value": 300 + }, + { + "id": "links", + "value": [ + { + "title": "PGCAT Table : ${__data.fields.Name}", + "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Name}" + } + ] + } + ] }, { - "id": "color", - "value": { - "fixedColor": "#3e668f", - "mode": "fixed" - } + "matcher": { + "id": "byName", + "options": "OID" + }, + "properties": [ + { + "id": "custom.width", + "value": 80 + }, + { + "id": "custom.cellOptions", + "value": { + "type": "auto" + } + }, + { + "id": "color", + "value": { + "fixedColor": "#3e668f", + "mode": "thresholds" + } + } + ] }, { - "id": "links", - "value": [] + "matcher": { + "id": "byType", + "options": "number" + }, + "properties": [ + { + "id": "custom.width", + "value": 70 + }, + { + "id": "custom.cellOptions", + "value": { + "type": "auto" + } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#3e668f", + "value": null + } + ] + } + } + ] }, { - "id": "custom.minWidth", - "value": 180 + "matcher": { + "id": "byName", + "options": "Age" + }, + "properties": [ + { + "id": "custom.width", + "value": 70 + }, + { + "id": "unit", + "value": "percentunit" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#346f36cc", + "value": null + }, + { + "color": "#fcdb72", + "value": 0.05 + }, + { + "color": "#f5a673", + "value": 0.1 + }, + { + "color": "#cc4637d9", + "value": 0.3 + }, + { + "color": "#b783af", + "value": 0.9 + }, + { + "color": "#000000", + "value": 0.99 + } + ] + } + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "color" + }, + { + "id": "decimals", + "value": 1 + }, + { + "id": "color", + "value": { + "mode": "thresholds" + } + } + ] }, { - "id": "custom.width", - "value": 200 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Name" - }, - "properties": [ - { - "id": "custom.align", - "value": "left" + "matcher": { + "id": "byName", + "options": "Tuples" + }, + "properties": [ + { + "id": "custom.width", + "value": 80 + }, + { + "id": "unit", + "value": "short" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "transparent", + "value": null + }, + { + "color": "#3e668f", + "value": 1 + }, + { + "color": "#346f36cc", + "value": 10000 + }, + { + "color": "#fcdb72", + "value": 1000000 + }, + { + "color": "#f5a673", + "value": 100000000 + }, + { + "color": "#cc4637d9", + "value": 10000000000 + } + ] + } + }, + { + "id": "mappings", + "value": [ + { + "options": { + "-1": { + "color": "transparent", + "index": 0, + "text": "N/A" + }, + "0": { + "color": "#00000000", + "index": 1, + "text": "0" + } + }, + "type": "value" + } + ] + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + } + ] }, { - "id": "custom.cellOptions", - "value": { - "type": "auto" - } + "matcher": { + "id": "byName", + "options": "Size" + }, + "properties": [ + { + "id": "custom.width", + "value": 110 + }, + { + "id": "unit", + "value": "bytes" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "transparent", + "value": null + }, + { + "color": "#3e668f", + "value": 1 + }, + { + "color": "#346f36cc", + "value": 8193 + }, + { + "color": "#fcdb72", + "value": 10000000000 + }, + { + "color": "#f5a673", + "value": 100000000000 + }, + { + "color": "#cc4637d9", + "value": 1000000000000 + } + ] + } + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "color" + } + ] }, { - "id": "custom.minWidth", - "value": 300 + "matcher": { + "id": "byName", + "options": "nAttr" + }, + "properties": [ + { + "id": "custom.width", + "value": 60 + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "transparent", + "value": null + }, + { + "color": "#3e668f", + "value": 1 + }, + { + "color": "#f5a673", + "value": 16 + }, + { + "color": "#cc4637d9", + "value": 32 + } + ] + } + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + } + ] }, { - "id": "links", - "value": [ + "matcher": { + "id": "byType", + "options": "time" + }, + "properties": [ { - "title": "PGCAT Table : ${__data.fields.Name}", - "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Name}" + "id": "unit", + "value": "dateTimeFromNow" + }, + { + "id": "custom.width", + "value": 160 + }, + { + "id": "custom.cellOptions", + "value": { + "type": "auto" + } } ] - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "OID" - }, - "properties": [ - { - "id": "custom.width", - "value": 80 }, { - "id": "custom.cellOptions", - "value": { - "type": "auto" - } + "matcher": { + "id": "byName", + "options": "Seq Scan" + }, + "properties": [ + { + "id": "custom.width", + "value": 110 + }, + { + "id": "unit", + "value": "locale" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "transparent", + "value": null + }, + { + "color": "#FF780A", + "value": 1 + }, + { + "color": "#cc4637d9", + "value": 1000 + }, + { + "color": "#b783af", + "value": 1000000 + } + ] + } + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + } + ] }, { - "id": "color", - "value": { - "fixedColor": "#3e668f", - "mode": "thresholds" - } - } - ] - }, - { - "matcher": { - "id": "byType", - "options": "number" - }, - "properties": [ - { - "id": "custom.width", - "value": 70 + "matcher": { + "id": "byName", + "options": "Kind" + }, + "properties": [ + { + "id": "custom.width", + "value": 150 + }, + { + "id": "mappings", + "value": [ + { + "options": { + "I": { + "color": "super-light-green", + "index": 9, + "text": "Partitioned Index" + }, + "P": { + "color": "#3274D9", + "index": 10, + "text": "Partition Table" + }, + "S": { + "color": "#fcdb72", + "index": 2, + "text": "Sequence" + }, + "c": { + "color": "super-light-orange", + "index": 6, + "text": "Componse Type" + }, + "f": { + "color": "#f5a673", + "index": 7, + "text": "Foreign table" + }, + "i": { + "color": "#346f36cc", + "index": 1, + "text": "Index" + }, + "m": { + "color": "dark-blue", + "index": 5, + "text": "Materialized View" + }, + "p": { + "color": "#284766", + "index": 8, + "text": "Partitioned Table" + }, + "r": { + "color": "#3e668f", + "index": 0, + "text": "Table" + }, + "t": { + "color": "#808080", + "index": 3, + "text": "Toast Table" + }, + "v": { + "color": "red", + "index": 4, + "text": "View" + } + }, + "type": "value" + } + ] + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "custom.filterable", + "value": true + } + ] }, { - "id": "custom.cellOptions", - "value": { - "type": "auto" - } + "matcher": { + "id": "byName", + "options": "Insert" + }, + "properties": [ + { + "id": "custom.width", + "value": 100 + }, + { + "id": "unit", + "value": "locale" + } + ] }, { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#3e668f", - "value": null - } - ] - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Age" - }, - "properties": [ + "matcher": { + "id": "byName", + "options": "Update" + }, + "properties": [ + { + "id": "custom.width", + "value": 100 + }, + { + "id": "unit", + "value": "locale" + } + ] + }, { - "id": "custom.width", - "value": 70 + "matcher": { + "id": "byName", + "options": "Delete" + }, + "properties": [ + { + "id": "custom.width", + "value": 63 + } + ] }, { - "id": "unit", - "value": "percentunit" + "matcher": { + "id": "byName", + "options": "Live" + }, + "properties": [ + { + "id": "custom.width", + "value": 128 + }, + { + "id": "unit", + "value": "locale" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "transparent", + "value": null + }, + { + "color": "#3e668f", + "value": 1 + }, + { + "color": "#346f36cc", + "value": 10000 + }, + { + "color": "#fcdb72", + "value": 1000000 + }, + { + "color": "#f5a673", + "value": 100000000 + }, + { + "color": "#cc4637d9", + "value": 10000000000 + } + ] + } + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + } + ] }, { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#346f36cc", - "value": null - }, - { - "color": "#fcdb72", - "value": 0.05 - }, - { - "color": "#f5a673", - "value": 0.1 - }, - { - "color": "#cc4637d9", - "value": 0.3 - }, - { - "color": "#b783af", - "value": 0.9 - }, - { - "color": "#000000", - "value": 0.99 + "matcher": { + "id": "byName", + "options": "Dead" + }, + "properties": [ + { + "id": "custom.width", + "value": 80 + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" } - ] - } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#346f36cc", + "value": null + }, + { + "color": "#3e668f", + "value": 1 + }, + { + "color": "#f5a673", + "value": 10000 + } + ] + } + } + ] }, { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } + "matcher": { + "id": "byRegexp", + "options": "/Scan|Seq ScanIdx Scan|Inserted|Updated|Deleted|Scan Rows|Index Rows|HOT Update|Modified/" + }, + "properties": [ + { + "id": "custom.width", + "value": 120 + }, + { + "id": "unit", + "value": "locale" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#7f7f7fc4", + "value": null + }, + { + "color": "#3e668f", + "value": 1 + } + ] + } + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + } + ] }, { - "id": "color" + "matcher": { + "id": "byName", + "options": "Deleted" + }, + "properties": [ + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#7f7f7fc4", + "value": null + }, + { + "color": "#cc4637d9", + "value": 1 + } + ] + } + } + ] }, { - "id": "decimals", - "value": 1 + "matcher": { + "id": "byName", + "options": "Updated" + }, + "properties": [ + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#7f7f7fc4", + "value": null + }, + { + "color": "#b783af", + "value": 1 + } + ] + } + } + ] }, { - "id": "color", - "value": { - "mode": "thresholds" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Tuples" - }, - "properties": [ + "matcher": { + "id": "byName", + "options": "Scan Rows" + }, + "properties": [ + { + "id": "custom.width", + "value": 120 + } + ] + }, { - "id": "custom.width", - "value": 80 + "matcher": { + "id": "byName", + "options": "Index Rows" + }, + "properties": [ + { + "id": "custom.width", + "value": 120 + } + ] }, { - "id": "unit", - "value": "short" + "matcher": { + "id": "byName", + "options": "Filenode" + }, + "properties": [ + { + "id": "custom.width", + "value": 80 + }, + { + "id": "color", + "value": { + "fixedColor": "#3e668f", + "mode": "fixed" + } + } + ] }, { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "transparent", - "value": null - }, - { - "color": "#3e668f", - "value": 1 - }, - { - "color": "#346f36cc", - "value": 10000 - }, - { - "color": "#fcdb72", - "value": 1000000 - }, - { - "color": "#f5a673", - "value": 100000000 - }, - { - "color": "#cc4637d9", - "value": 10000000000 + "matcher": { + "id": "byRegexp", + "options": "/(.*Analyze|Vacuum).*Count/" + }, + "properties": [ + { + "id": "custom.width", + "value": 160 + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#7f7f7fc4", + "value": null + }, + { + "color": "#3e668f", + "value": 1 + } + ] } - ] - } + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + } + ] }, { - "id": "mappings", - "value": [ + "matcher": { + "id": "byName", + "options": "nInsSinceVacuum" + }, + "properties": [ { - "options": { - "-1": { - "color": "transparent", - "index": 0, - "text": "N/A" - }, - "0": { - "color": "#00000000", - "index": 1, - "text": "0" - } - }, - "type": "value" + "id": "custom.width", + "value": 140 + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#7f7f7fc4", + "value": null + }, + { + "color": "#cc4637d9", + "value": 80 + } + ] + } + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } } ] }, { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } + "matcher": { + "id": "byName", + "options": "nModSinceAnalyze" + }, + "properties": [ + { + "id": "custom.width", + "value": 140 + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#7f7f7fc4", + "value": null + }, + { + "color": "#cc4637d9", + "value": 1 + } + ] + } + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + } + ] } ] }, - { - "matcher": { - "id": "byName", - "options": "Size" + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 23 + }, + "id": 189, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "enablePagination": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false }, - "properties": [ + "showHeader": true, + "sortBy": [ { - "id": "custom.width", - "value": 110 - }, - { - "id": "unit", - "value": "bytes" - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "transparent", - "value": null - }, - { - "color": "#3e668f", - "value": 1 - }, - { - "color": "#346f36cc", - "value": 8193 - }, - { - "color": "#fcdb72", - "value": 10000000000 - }, - { - "color": "#f5a673", - "value": 100000000000 - }, - { - "color": "#cc4637d9", - "value": 1000000000000 - } - ] - } - }, - { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } - }, - { - "id": "color" + "desc": true, + "displayName": "Size" } ] }, - { - "matcher": { - "id": "byName", - "options": "nAttr" - }, - "properties": [ - { - "id": "custom.width", - "value": 60 - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "transparent", - "value": null - }, - { - "color": "#3e668f", - "value": 1 - }, - { - "color": "#f5a673", - "value": 16 + "pluginVersion": "11.1.4", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "${dsn}" + }, + "editorMode": "code", + "exemplar": false, + "expr": "SELECT * FROM pg_class;", + "format": "table", + "group": [], + "instant": true, + "interval": "", + "legendFormat": "", + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT c.oid,\n n.nspname,\n n.nspname || '.' || c.relname AS name,\n CASE WHEN relispartition THEN 'P' ELSE c.relkind END AS kind,\n age(c.relfrozenxid)::FLOAT / 2147483648 AS relage,\n (n_tup_ins + n_tup_upd + n_tup_del) AS n_tup_mod,\n seq_scan + idx_scan AS tbl_scan,\n seq_tup_read + idx_tup_fetch AS tup_read,\n reltuples,\n relpages,\n relfilenode,\n pg_table_size(c.oid) AS size,\n relnatts,\n s.seq_scan,\n s.seq_tup_read,\n s.idx_scan,\n s.idx_tup_fetch,\n s.n_tup_ins,\n s.n_tup_upd,\n s.n_tup_del,\n s.n_tup_hot_upd,\n -- s.n_tup_newpage_upd, -- PG16\n s.n_live_tup,\n s.n_dead_tup,\n s.n_mod_since_analyze,\n -- s.n_ins_since_vacuum, -- PG13\n extract(EPOCH FROM s.last_vacuum) * 1000 AS last_vacuum,\n extract(EPOCH FROM s.last_autovacuum) * 1000 AS last_autovacuum,\n extract(EPOCH FROM s.last_analyze) * 1000 AS last_analyze,\n extract(EPOCH FROM s.last_autoanalyze) * 1000 AS last_autoanalyze,\n s.vacuum_count,\n s.autovacuum_count,\n s.analyze_count,\n s.autoanalyze_count\nFROM pg_catalog.pg_class c\n LEFT JOIN pg_namespace n ON n.oid = c.relnamespace\n LEFT JOIN pg_stat_user_tables s ON c.oid = s.relid\nWHERE c.relkind IN ('r', 'p', '')\n AND schemaname = '$schema'\nORDER BY 1, 2;\n\n\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" }, - { - "color": "#cc4637d9", - "value": 32 - } - ] + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" } - }, - { - "id": "custom.cellOptions", - "value": { - "type": "color-text" + ] + } + ], + "title": "Tables", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": { + "Time 1": true, + "Time 10": true, + "Time 2": true, + "Time 3": true, + "Time 4": true, + "Time 5": true, + "Time 6": true, + "Time 7": true, + "Time 8": true, + "Time 9": true, + "acl": true, + "analyze_count": false, + "autoanalyze_count": false, + "autovacuum_count": false, + "datcollate": true, + "datctype": true, + "datfrozenxid": true, + "description": true, + "encoding": true, + "idx_tup_fetch": false, + "n_ins_since_vacuum": false, + "n_mod_since_analyze": false, + "n_tup_hot_upd": false, + "nspname": true, + "relam": true, + "relfilenode": false, + "relid": true, + "relname": true, + "relnamespace": true, + "reloftype": true, + "relpages": true, + "reltype": true, + "schemaname": true, + "seq_tup_read": false, + "tablespace": true, + "vacuum_count": false + }, + "indexByName": { + "analyze_count": 32, + "autoanalyze_count": 34, + "autovacuum_count": 29, + "idx_scan": 14, + "idx_tup_fetch": 16, + "kind": 3, + "last_analyze": 33, + "last_autoanalyze": 35, + "last_autovacuum": 30, + "last_vacuum": 28, + "n_dead_tup": 10, + "n_ins_since_vacuum": 26, + "n_live_tup": 9, + "n_mod_since_analyze": 31, + "n_tup_del": 20, + "n_tup_hot_upd": 22, + "n_tup_ins": 19, + "n_tup_mod": 18, + "n_tup_upd": 21, + "name": 1, + "nspname": 2, + "oid": 0, + "relage": 7, + "relfilenode": 5, + "relid": 23, + "relname": 25, + "relnatts": 6, + "relpages": 11, + "reltuples": 8, + "schemaname": 24, + "seq_scan": 13, + "seq_tup_read": 15, + "size": 4, + "tbl_scan": 12, + "tup_read": 17, + "vacuum_count": 27 + }, + "renameByName": { + "I": "Partitioned Index", + "Kind": "Kind", + "S": "Sequence", + "Size": "Size", + "Time 1": "", + "Time 7": "", + "Value #A": "Size", + "Value #B": "Age", + "Value #C": "Status", + "Value #D": "Session", + "Value #E": "TPS", + "Value #F": "ConnLimit", + "Value #G": "Reserve", + "Value #H": "Current", + "Value #I": "Disable", + "Value #J": "Pause", + "acl": "Privileges", + "age": "Age", + "analyze_count": "Analyze Count", + "autoanalyze_count": "AutoAnalyze Count", + "autovacuum_count": "AutoVacuum Count", + "c": "Compose Type", + "datallowconn": "Conn", + "datcollate": "Collate", + "datconnlimit": "ConnLimit", + "datctype": "Ctype", + "datfrozenxid": "FronzenXID", + "datistemplate": "Tmpl", + "datname": "Database", + "description": "Description", + "encoding": "Encoding", + "f": "Foreign Table", + "host": "Target", + "i": "Index", + "idx_scan": "Idx Scan", + "idx_tup_fetch": "Index Rows", + "kind": "Kind", + "last_analyze": "Last Analyze", + "last_autoanalyze": "Last AutoAnalyze", + "last_autovacuum": "Last AutoVacuum", + "last_vacuum": "Last Vacuum", + "m": "Materialized View", + "n_dead_tup": "Dead", + "n_ins_since_vacuum": "nInsSinceVacuum", + "n_live_tup": "Live", + "n_mod_since_analyze": "nModSinceAnalyze", + "n_tup_del": "Deleted", + "n_tup_hot_upd": "HOT Update", + "n_tup_ins": "Inserted", + "n_tup_mod": "Modified", + "n_tup_upd": "Updated", + "name": "Name", + "nspname": "Schema", + "oid": "OID", + "owner": "Owner", + "p": "Partitioned Table", + "pg_table_size": "Size", + "r": "Table", + "real_datname": "Datname", + "rel": "Table", + "relage": "Age", + "relfilenode": "Filenode", + "relhasindex": "", + "relid": "", + "relkind": "Kind", + "relname": "", + "relnatts": "nAttr", + "relpages": "Pages", + "relpersistence": "Persist", + "reltuples": "Tuples", + "seq_scan": "Seq Scan", + "seq_tup_read": "Scan Rows", + "sessions": "Session", + "size": "Size", + "status": "Status", + "t": "Toast", + "tablespace": "Tablespace", + "tbl_scan": "Scan", + "tup_read": "Scanned", + "v": "View", + "vacuum_count": "Vacuum Count" } } - ] + } + ], + "type": "table" + } + ], + "title": "Table", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "ds-prometheus" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 23 + }, + "id": 154, + "panels": [ + { + "datasource": { + "type": "postgres", + "uid": "${dsn}" }, - { - "matcher": { - "id": "byType", - "options": "time" + "description": "Read = Returned Rows\n\nFetch = Scanned Rows", + "fieldConfig": { + "defaults": { + "custom": { + "align": "center", + "cellOptions": { + "type": "auto" + }, + "filterable": false, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#e3e3e3e0", + "value": null + } + ] + } }, - "properties": [ + "overrides": [ { - "id": "unit", - "value": "dateTimeFromNow" + "matcher": { + "id": "byName", + "options": "Table ID" + }, + "properties": [ + { + "id": "custom.width", + "value": 90 + }, + { + "id": "custom.filterable", + "value": true + } + ] }, { - "id": "custom.width", - "value": 160 + "matcher": { + "id": "byName", + "options": "Index ID" + }, + "properties": [ + { + "id": "custom.width", + "value": 90 + } + ] }, { - "id": "custom.cellOptions", - "value": { - "type": "auto" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Seq Scan" - }, - "properties": [ + "matcher": { + "id": "byName", + "options": "Schema" + }, + "properties": [ + { + "id": "custom.width", + "value": 100 + } + ] + }, { - "id": "custom.width", - "value": 110 + "matcher": { + "id": "byName", + "options": "Table" + }, + "properties": [ + { + "id": "links", + "value": [ + { + "title": "Relation detail for ${__data.fields.Table}", + "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Table}" + } + ] + }, + { + "id": "custom.align", + "value": "left" + }, + { + "id": "custom.filterable", + "value": true + } + ] }, { - "id": "unit", - "value": "locale" + "matcher": { + "id": "byName", + "options": "Index" + }, + "properties": [ + { + "id": "links", + "value": [ + { + "title": "${__data.fields.Define}", + "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Index}" + } + ] + }, + { + "id": "custom.minWidth", + "value": 300 + }, + { + "id": "custom.align", + "value": "left" + } + ] }, { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "transparent", - "value": null - }, - { - "color": "#FF780A", - "value": 1 - }, - { - "color": "#cc4637d9", - "value": 1000 - }, - { - "color": "#b783af", - "value": 1000000 + "matcher": { + "id": "byName", + "options": "Define" + }, + "properties": [ + { + "id": "custom.cellOptions", + "value": { + "type": "auto" } - ] - } + }, + { + "id": "custom.align", + "value": "left" + }, + { + "id": "custom.minWidth", + "value": 300 + }, + { + "id": "custom.inspect", + "value": true + } + ] }, { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } + "matcher": { + "id": "byRegexp", + "options": "/Scan|Tup Read|Tup Fetch/" + }, + "properties": [ + { + "id": "custom.width", + "value": 110 + }, + { + "id": "unit", + "value": "locale" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#747474b3", + "value": null + }, + { + "color": "#3e668f", + "value": 1 + } + ] + } + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + } + ] } ] }, - { - "matcher": { - "id": "byName", - "options": "Kind" + "gridPos": { + "h": 11, + "w": 24, + "x": 0, + "y": 33 + }, + "id": 184, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false }, - "properties": [ - { - "id": "custom.width", - "value": 150 - }, + "showHeader": true, + "sortBy": [ { - "id": "mappings", - "value": [ + "desc": true, + "displayName": "Scan" + } + ] + }, + "pluginVersion": "11.1.4", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "${dsn}" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT schemaname || '.' || indexrelname AS \"Index\", \n schemaname || '.' || relname AS \"Table\", \n *,\n pg_get_indexdef(indexrelid) AS def\nFROM pg_stat_user_indexes\nWHERE schemaname = '$schema';", + "refId": "A", + "select": [ + [ { - "options": { - "I": { - "color": "super-light-green", - "index": 9, - "text": "Partitioned Index" - }, - "P": { - "color": "#3274D9", - "index": 10, - "text": "Partition Table" - }, - "S": { - "color": "#fcdb72", - "index": 2, - "text": "Sequence" - }, - "c": { - "color": "super-light-orange", - "index": 6, - "text": "Componse Type" - }, - "f": { - "color": "#f5a673", - "index": 7, - "text": "Foreign table" - }, - "i": { - "color": "#346f36cc", - "index": 1, - "text": "Index" - }, - "m": { - "color": "dark-blue", - "index": 5, - "text": "Materialized View" - }, - "p": { - "color": "#284766", - "index": 8, - "text": "Partitioned Table" - }, - "r": { - "color": "#3e668f", - "index": 0, - "text": "Table" - }, - "t": { - "color": "#808080", - "index": 3, - "text": "Toast Table" - }, - "v": { - "color": "red", - "index": 4, - "text": "View" - } - }, - "type": "value" + "params": [ + "value" + ], + "type": "column" } ] - }, - { - "id": "custom.cellOptions", - "value": { - "type": "color-text" + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Indexes", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": { + "indexrelname": true, + "relname": true, + "schemaname": true + }, + "indexByName": { + "Index": 1, + "Table": 0, + "def": 2, + "idx_scan": 8, + "idx_tup_fetch": 10, + "idx_tup_read": 9, + "indexrelid": 6, + "indexrelname": 5, + "relid": 7, + "relname": 3, + "schemaname": 4 + }, + "renameByName": { + "Index": "Index", + "Name": "Name", + "Table": "Table", + "def": "Define", + "idx_scan": "Scan", + "idx_tup_fetch": "Tup Fetch", + "idx_tup_read": "Tup Read", + "indexrelid": "Index ID", + "indexrelname": "", + "relid": "Table ID", + "relname": "", + "schemaname": "" } - }, - { - "id": "custom.filterable", - "value": true } - ] + } + ], + "type": "table" + } + ], + "title": "Index", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 24 + }, + "id": 195, + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${dsn}" }, - { - "matcher": { - "id": "byName", - "options": "Insert" - }, - "properties": [ - { - "id": "custom.width", - "value": 100 + "description": "Bloat ratio & wasted bytes estimation of all heap tables", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "center", + "cellOptions": { + "type": "auto" + }, + "filterable": false, + "inspect": false }, - { - "id": "unit", - "value": "locale" + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#346f36cc", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Update" }, - "properties": [ + "overrides": [ { - "id": "custom.width", - "value": 100 + "matcher": { + "id": "byName", + "options": "Relation" + }, + "properties": [ + { + "id": "custom.align", + "value": "left" + }, + { + "id": "links", + "value": [ + { + "title": "PGCAT Table for ${__data.fields.Relation} on ${ins}.${datname}", + "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Relation}" + } + ] + } + ] }, { - "id": "unit", - "value": "locale" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Delete" - }, - "properties": [ - { - "id": "custom.width", - "value": 63 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Live" - }, - "properties": [ + "matcher": { + "id": "byName", + "options": "Database" + }, + "properties": [ + { + "id": "custom.width", + "value": 160 + } + ] + }, { - "id": "custom.width", - "value": 128 + "matcher": { + "id": "byName", + "options": "Size" + }, + "properties": [ + { + "id": "custom.width", + "value": 80 + }, + { + "id": "unit", + "value": "decbytes" + } + ] }, { - "id": "unit", - "value": "locale" + "matcher": { + "id": "byName", + "options": "Ratio" + }, + "properties": [ + { + "id": "custom.width", + "value": 100 + }, + { + "id": "unit", + "value": "percentunit" + }, + { + "id": "decimals", + "value": 1 + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#3e668f", + "value": null + }, + { + "color": "#346f36cc", + "value": 0.1 + }, + { + "color": "#EAB839", + "value": 0.3 + }, + { + "color": "#f5a673", + "value": 0.5 + }, + { + "color": "red", + "value": 0.7 + }, + { + "color": "#b783af", + "value": 0.9 + }, + { + "color": "rgb(0, 0, 0)", + "value": 0.999 + } + ] + } + }, + { + "id": "custom.cellOptions", + "value": { + "mode": "gradient", + "type": "color-background" + } + } + ] }, { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "transparent", - "value": null - }, - { - "color": "#3e668f", - "value": 1 - }, - { - "color": "#346f36cc", - "value": 10000 - }, - { - "color": "#fcdb72", - "value": 1000000 - }, - { - "color": "#f5a673", - "value": 100000000 - }, - { - "color": "#cc4637d9", - "value": 10000000000 + "matcher": { + "id": "byName", + "options": "Waste" + }, + "properties": [ + { + "id": "unit", + "value": "decbytes" + }, + { + "id": "custom.width", + "value": 100 + }, + { + "id": "custom.cellOptions", + "value": { + "mode": "gradient", + "type": "color-background" } - ] - } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#3e668f", + "value": null + }, + { + "color": "#346f36cc", + "value": 100000000 + }, + { + "color": "#f5a673", + "value": 1000000000 + }, + { + "color": "#EAB839", + "value": 2000000000 + }, + { + "color": "red", + "value": 4000000000 + }, + { + "color": "#b783af", + "value": 8000000000 + } + ] + } + } + ] }, { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } + "matcher": { + "id": "byName", + "options": "TableID" + }, + "properties": [ + { + "id": "custom.width", + "value": 100 + } + ] } ] }, - { - "matcher": { - "id": "byName", - "options": "Dead" + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 45 + }, + "id": 190, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false }, - "properties": [ - { - "id": "custom.width", - "value": 80 - }, - { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#346f36cc", - "value": null - }, - { - "color": "#3e668f", - "value": 1 - }, - { - "color": "#f5a673", - "value": 10000 - } - ] - } - } - ] + "showHeader": true, + "sortBy": [] }, - { - "matcher": { - "id": "byRegexp", - "options": "/Scan|Seq ScanIdx Scan|Inserted|Updated|Deleted|Scan Rows|Index Rows|HOT Update|Modified/" - }, - "properties": [ - { - "id": "custom.width", - "value": 120 - }, - { - "id": "unit", - "value": "locale" - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#7f7f7fc4", - "value": null - }, - { - "color": "#3e668f", - "value": 1 - } - ] - } - }, - { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Deleted" - }, - "properties": [ - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#7f7f7fc4", - "value": null - }, - { - "color": "#cc4637d9", - "value": 1 - } - ] - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Updated" - }, - "properties": [ - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#7f7f7fc4", - "value": null - }, - { - "color": "#b783af", - "value": 1 - } - ] - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Scan Rows" - }, - "properties": [ - { - "id": "custom.width", - "value": 120 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Index Rows" - }, - "properties": [ - { - "id": "custom.width", - "value": 120 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Filenode" - }, - "properties": [ - { - "id": "custom.width", - "value": 80 - }, - { - "id": "color", - "value": { - "fixedColor": "#3e668f", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byRegexp", - "options": "/(.*Analyze|Vacuum).*Count/" - }, - "properties": [ - { - "id": "custom.width", - "value": 160 - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#7f7f7fc4", - "value": null - }, - { - "color": "#3e668f", - "value": 1 - } - ] - } - }, - { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "nInsSinceVacuum" - }, - "properties": [ - { - "id": "custom.width", - "value": 140 - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#7f7f7fc4", - "value": null - }, - { - "color": "#cc4637d9", - "value": 80 - } - ] - } - }, - { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "nModSinceAnalyze" - }, - "properties": [ - { - "id": "custom.width", - "value": 140 - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#7f7f7fc4", - "value": null - }, - { - "color": "#cc4637d9", - "value": 1 - } - ] - } - }, - { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } - } - ] - } - ] - }, - "gridPos": { - "h": 9, - "w": 24, - "x": 0, - "y": 23 - }, - "id": 189, - "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "enablePagination": false, - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [ - { - "desc": true, - "displayName": "Size" - } - ] - }, - "pluginVersion": "11.1.4", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "${dsn}" - }, - "editorMode": "code", - "exemplar": false, - "expr": "SELECT * FROM pg_class;", - "format": "table", - "group": [], - "instant": true, - "interval": "", - "legendFormat": "", - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT c.oid,\n n.nspname,\n n.nspname || '.' || c.relname AS name,\n CASE WHEN relispartition THEN 'P' ELSE c.relkind END AS kind,\n age(c.relfrozenxid)::FLOAT / 2147483648 AS relage,\n (n_tup_ins + n_tup_upd + n_tup_del) AS n_tup_mod,\n seq_scan + idx_scan AS tbl_scan,\n seq_tup_read + idx_tup_fetch AS tup_read,\n reltuples,\n relpages,\n relfilenode,\n pg_table_size(c.oid) AS size,\n relnatts,\n s.seq_scan,\n s.seq_tup_read,\n s.idx_scan,\n s.idx_tup_fetch,\n s.n_tup_ins,\n s.n_tup_upd,\n s.n_tup_del,\n s.n_tup_hot_upd,\n -- s.n_tup_newpage_upd, -- PG16\n s.n_live_tup,\n s.n_dead_tup,\n s.n_mod_since_analyze,\n -- s.n_ins_since_vacuum, -- PG13\n extract(EPOCH FROM s.last_vacuum) * 1000 AS last_vacuum,\n extract(EPOCH FROM s.last_autovacuum) * 1000 AS last_autovacuum,\n extract(EPOCH FROM s.last_analyze) * 1000 AS last_analyze,\n extract(EPOCH FROM s.last_autoanalyze) * 1000 AS last_autoanalyze,\n s.vacuum_count,\n s.autovacuum_count,\n s.analyze_count,\n s.autoanalyze_count\nFROM pg_catalog.pg_class c\n LEFT JOIN pg_namespace n ON n.oid = c.relnamespace\n LEFT JOIN pg_stat_user_tables s ON c.oid = s.relid\nWHERE c.relkind IN ('r', 'p', '')\n AND schemaname = '$schema'\nORDER BY 1, 2;\n\n\n", - "refId": "A", - "select": [ - [ - { - "params": [ - "value" - ], - "type": "column" - } - ] - ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - }, - "timeColumn": "time", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Tables", - "transformations": [ - { - "id": "organize", - "options": { - "excludeByName": { - "Time 1": true, - "Time 10": true, - "Time 2": true, - "Time 3": true, - "Time 4": true, - "Time 5": true, - "Time 6": true, - "Time 7": true, - "Time 8": true, - "Time 9": true, - "acl": true, - "analyze_count": false, - "autoanalyze_count": false, - "autovacuum_count": false, - "datcollate": true, - "datctype": true, - "datfrozenxid": true, - "description": true, - "encoding": true, - "idx_tup_fetch": false, - "n_ins_since_vacuum": false, - "n_mod_since_analyze": false, - "n_tup_hot_upd": false, - "nspname": true, - "relam": true, - "relfilenode": false, - "relid": true, - "relname": true, - "relnamespace": true, - "reloftype": true, - "relpages": true, - "reltype": true, - "schemaname": true, - "seq_tup_read": false, - "tablespace": true, - "vacuum_count": false - }, - "indexByName": { - "analyze_count": 32, - "autoanalyze_count": 34, - "autovacuum_count": 29, - "idx_scan": 14, - "idx_tup_fetch": 16, - "kind": 3, - "last_analyze": 33, - "last_autoanalyze": 35, - "last_autovacuum": 30, - "last_vacuum": 28, - "n_dead_tup": 10, - "n_ins_since_vacuum": 26, - "n_live_tup": 9, - "n_mod_since_analyze": 31, - "n_tup_del": 20, - "n_tup_hot_upd": 22, - "n_tup_ins": 19, - "n_tup_mod": 18, - "n_tup_upd": 21, - "name": 1, - "nspname": 2, - "oid": 0, - "relage": 7, - "relfilenode": 5, - "relid": 23, - "relname": 25, - "relnatts": 6, - "relpages": 11, - "reltuples": 8, - "schemaname": 24, - "seq_scan": 13, - "seq_tup_read": 15, - "size": 4, - "tbl_scan": 12, - "tup_read": 17, - "vacuum_count": 27 - }, - "renameByName": { - "I": "Partitioned Index", - "Kind": "Kind", - "S": "Sequence", - "Size": "Size", - "Time 1": "", - "Time 7": "", - "Value #A": "Size", - "Value #B": "Age", - "Value #C": "Status", - "Value #D": "Session", - "Value #E": "TPS", - "Value #F": "ConnLimit", - "Value #G": "Reserve", - "Value #H": "Current", - "Value #I": "Disable", - "Value #J": "Pause", - "acl": "Privileges", - "age": "Age", - "analyze_count": "Analyze Count", - "autoanalyze_count": "AutoAnalyze Count", - "autovacuum_count": "AutoVacuum Count", - "c": "Compose Type", - "datallowconn": "Conn", - "datcollate": "Collate", - "datconnlimit": "ConnLimit", - "datctype": "Ctype", - "datfrozenxid": "FronzenXID", - "datistemplate": "Tmpl", - "datname": "Database", - "description": "Description", - "encoding": "Encoding", - "f": "Foreign Table", - "host": "Target", - "i": "Index", - "idx_scan": "Idx Scan", - "idx_tup_fetch": "Index Rows", - "kind": "Kind", - "last_analyze": "Last Analyze", - "last_autoanalyze": "Last AutoAnalyze", - "last_autovacuum": "Last AutoVacuum", - "last_vacuum": "Last Vacuum", - "m": "Materialized View", - "n_dead_tup": "Dead", - "n_ins_since_vacuum": "nInsSinceVacuum", - "n_live_tup": "Live", - "n_mod_since_analyze": "nModSinceAnalyze", - "n_tup_del": "Deleted", - "n_tup_hot_upd": "HOT Update", - "n_tup_ins": "Inserted", - "n_tup_mod": "Modified", - "n_tup_upd": "Updated", - "name": "Name", - "nspname": "Schema", - "oid": "OID", - "owner": "Owner", - "p": "Partitioned Table", - "pg_table_size": "Size", - "r": "Table", - "real_datname": "Datname", - "rel": "Table", - "relage": "Age", - "relfilenode": "Filenode", - "relhasindex": "", - "relid": "", - "relkind": "Kind", - "relname": "", - "relnatts": "nAttr", - "relpages": "Pages", - "relpersistence": "Persist", - "reltuples": "Tuples", - "seq_scan": "Seq Scan", - "seq_tup_read": "Scan Rows", - "sessions": "Session", - "size": "Size", - "status": "Status", - "t": "Toast", - "tablespace": "Tablespace", - "tbl_scan": "Scan", - "tup_read": "Scanned", - "v": "View", - "vacuum_count": "Vacuum Count" - } - } - } - ], - "type": "table" - }, - { - "collapsed": false, - "datasource": { - "type": "prometheus", - "uid": "ds-prometheus" - }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 32 - }, - "id": 154, - "panels": [], - "title": "Index", - "type": "row" - }, - { - "datasource": { - "type": "postgres", - "uid": "${dsn}" - }, - "description": "Read = Returned Rows\n\nFetch = Scanned Rows", - "fieldConfig": { - "defaults": { - "custom": { - "align": "center", - "cellOptions": { - "type": "auto" - }, - "filterable": false, - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "#e3e3e3e0", - "value": null - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Table ID" - }, - "properties": [ - { - "id": "custom.width", - "value": 90 - }, - { - "id": "custom.filterable", - "value": true - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Index ID" - }, - "properties": [ - { - "id": "custom.width", - "value": 90 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Schema" - }, - "properties": [ - { - "id": "custom.width", - "value": 100 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Table" - }, - "properties": [ - { - "id": "links", - "value": [ - { - "title": "Relation detail for ${__data.fields.Table}", - "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Table}" - } - ] - }, - { - "id": "custom.align", - "value": "left" - }, - { - "id": "custom.filterable", - "value": true - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Index" - }, - "properties": [ - { - "id": "links", - "value": [ - { - "title": "${__data.fields.Define}", - "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Index}" - } - ] - }, - { - "id": "custom.minWidth", - "value": 300 - }, - { - "id": "custom.align", - "value": "left" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Define" - }, - "properties": [ - { - "id": "custom.cellOptions", - "value": { - "type": "auto" - } - }, - { - "id": "custom.align", - "value": "left" - }, - { - "id": "custom.minWidth", - "value": 300 - }, - { - "id": "custom.inspect", - "value": true - } - ] - }, - { - "matcher": { - "id": "byRegexp", - "options": "/Scan|Tup Read|Tup Fetch/" - }, - "properties": [ - { - "id": "custom.width", - "value": 110 - }, - { - "id": "unit", - "value": "locale" - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#747474b3", - "value": null - }, - { - "color": "#3e668f", - "value": 1 - } - ] - } - }, - { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } - } - ] - } - ] - }, - "gridPos": { - "h": 11, - "w": 24, - "x": 0, - "y": 33 - }, - "id": 184, - "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [ - { - "desc": true, - "displayName": "Scan" - } - ] - }, - "pluginVersion": "11.1.4", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "${dsn}" - }, - "editorMode": "code", - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT schemaname || '.' || indexrelname AS \"Index\", \n schemaname || '.' || relname AS \"Table\", \n *,\n pg_get_indexdef(indexrelid) AS def\nFROM pg_stat_user_indexes\nWHERE schemaname = '$schema';", - "refId": "A", - "select": [ - [ - { - "params": [ - "value" - ], - "type": "column" - } - ] - ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - }, - "timeColumn": "time", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Indexes", - "transformations": [ - { - "id": "organize", - "options": { - "excludeByName": { - "indexrelname": true, - "relname": true, - "schemaname": true - }, - "indexByName": { - "Index": 1, - "Table": 0, - "def": 2, - "idx_scan": 8, - "idx_tup_fetch": 10, - "idx_tup_read": 9, - "indexrelid": 6, - "indexrelname": 5, - "relid": 7, - "relname": 3, - "schemaname": 4 - }, - "renameByName": { - "Index": "Index", - "Name": "Name", - "Table": "Table", - "def": "Define", - "idx_scan": "Scan", - "idx_tup_fetch": "Tup Fetch", - "idx_tup_read": "Tup Read", - "indexrelid": "Index ID", - "indexrelname": "", - "relid": "Table ID", - "relname": "", - "schemaname": "" - } - } - } - ], - "type": "table" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 44 - }, - "id": 195, - "panels": [], - "title": "Bloat", - "type": "row" - }, - { - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "${dsn}" - }, - "description": "Bloat ratio & wasted bytes estimation of all heap tables", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "center", - "cellOptions": { - "type": "auto" - }, - "filterable": false, - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "#346f36cc", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Relation" - }, - "properties": [ - { - "id": "custom.align", - "value": "left" - }, - { - "id": "links", - "value": [ - { - "title": "PGCAT Table for ${__data.fields.Relation} on ${ins}.${datname}", - "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Relation}" - } - ] - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Database" - }, - "properties": [ - { - "id": "custom.width", - "value": 160 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Size" - }, - "properties": [ - { - "id": "custom.width", - "value": 80 - }, - { - "id": "unit", - "value": "decbytes" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Ratio" - }, - "properties": [ - { - "id": "custom.width", - "value": 100 - }, - { - "id": "unit", - "value": "percentunit" - }, - { - "id": "decimals", - "value": 1 - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#3e668f", - "value": null - }, - { - "color": "#346f36cc", - "value": 0.1 - }, - { - "color": "#EAB839", - "value": 0.3 - }, - { - "color": "#f5a673", - "value": 0.5 - }, - { - "color": "red", - "value": 0.7 - }, - { - "color": "#b783af", - "value": 0.9 - }, - { - "color": "rgb(0, 0, 0)", - "value": 0.999 - } - ] - } - }, - { - "id": "custom.cellOptions", - "value": { - "mode": "gradient", - "type": "color-background" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Waste" - }, - "properties": [ - { - "id": "unit", - "value": "decbytes" - }, - { - "id": "custom.width", - "value": 100 - }, - { - "id": "custom.cellOptions", - "value": { - "mode": "gradient", - "type": "color-background" - } - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#3e668f", - "value": null - }, - { - "color": "#346f36cc", - "value": 100000000 - }, - { - "color": "#f5a673", - "value": 1000000000 - }, - { - "color": "#EAB839", - "value": 2000000000 - }, - { - "color": "red", - "value": 4000000000 - }, - { - "color": "#b783af", - "value": 8000000000 - } - ] - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "TableID" - }, - "properties": [ - { - "id": "custom.width", - "value": 100 - } - ] - } - ] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 45 - }, - "id": 190, - "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] - }, - "pluginVersion": "11.1.4", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "${dsn}" - }, - "editorMode": "code", - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT CURRENT_CATALOG AS datname, nspname || '.' || relname AS relname, tblid , bs * tblpages AS size,\n CASE WHEN tblpages - est_tblpages_ff > 0 THEN (tblpages - est_tblpages_ff)/tblpages::FLOAT ELSE 0 END AS ratio\nFROM (\n SELECT ceil( reltuples / ( (bs-page_hdr)*fillfactor/(tpl_size*100) ) ) + ceil( toasttuples / 4 ) AS est_tblpages_ff,\n tblpages, fillfactor, bs, tblid, nspname, relname, is_na\n FROM (\n SELECT\n ( 4 + tpl_hdr_size + tpl_data_size + (2 * ma)\n - CASE WHEN tpl_hdr_size % ma = 0 THEN ma ELSE tpl_hdr_size % ma END\n - CASE WHEN ceil(tpl_data_size)::INT % ma = 0 THEN ma ELSE ceil(tpl_data_size)::INT % ma END\n ) AS tpl_size, (heappages + toastpages) AS tblpages, heappages,\n toastpages, reltuples, toasttuples, bs, page_hdr, tblid, nspname, relname, fillfactor, is_na\n FROM (\n SELECT\n tbl.oid AS tblid, ns.nspname , tbl.relname, tbl.reltuples,\n tbl.relpages AS heappages, coalesce(toast.relpages, 0) AS toastpages,\n coalesce(toast.reltuples, 0) AS toasttuples,\n coalesce(substring(array_to_string(tbl.reloptions, ' ') FROM 'fillfactor=([0-9]+)')::smallint, 100) AS fillfactor,\n current_setting('block_size')::numeric AS bs,\n CASE WHEN version()~'mingw32' OR version()~'64-bit|x86_64|ppc64|ia64|amd64' THEN 8 ELSE 4 END AS ma,\n 24 AS page_hdr,\n 23 + CASE WHEN MAX(coalesce(s.null_frac,0)) > 0 THEN ( 7 + count(s.attname) ) / 8 ELSE 0::int END\n + CASE WHEN bool_or(att.attname = 'oid' and att.attnum < 0) THEN 4 ELSE 0 END AS tpl_hdr_size,\n sum( (1-coalesce(s.null_frac, 0)) * coalesce(s.avg_width, 0) ) AS tpl_data_size,\n bool_or(att.atttypid = 'pg_catalog.name'::regtype)\n OR sum(CASE WHEN att.attnum > 0 THEN 1 ELSE 0 END) <> count(s.attname) AS is_na\n FROM pg_attribute AS att\n JOIN pg_class AS tbl ON att.attrelid = tbl.oid\n JOIN pg_namespace AS ns ON ns.oid = tbl.relnamespace\n LEFT JOIN pg_stats AS s ON s.schemaname=ns.nspname AND s.tablename = tbl.relname AND s.inherited=false AND s.attname=att.attname\n LEFT JOIN pg_class AS toast ON tbl.reltoastrelid = toast.oid\n WHERE NOT att.attisdropped AND tbl.relkind = 'r' AND nspname = '$schema'\n GROUP BY tbl.oid, ns.nspname, tbl.relname, tbl.reltuples, tbl.relpages, toast.relpages, toast.reltuples, tbl.reloptions\n ) AS s\n ) AS s2\n ) AS s3\nWHERE NOT is_na;", - "refId": "A", - "select": [ - [ - { - "params": [ - "probability" - ], - "type": "column" - } - ] - ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - }, - "table": "auto_suspicious_matches", - "timeColumn": "created_time", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Table Bloat", - "transformations": [ - { - "id": "organize", - "options": { - "excludeByName": {}, - "includeByName": {}, - "indexByName": { - "bloat_size": 4, - "datname": 0, - "nspname": 1, - "ratio": 5, - "relname": 2, - "size": 3 - }, - "renameByName": { - "bloat_size": "Waste", - "datname": "Database", - "nspname": "Schema", - "ratio": "Ratio", - "relname": "Relation", - "size": "Size", - "tblid": "TableID", - "waste": "Waste" - } - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "${dsn}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "links": [ - { - "title": "PGCAT Table for ${__data.fields.Relation} on ${ins}.${datname}", - "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Relation}" - } - ], - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "#346f36cc", - "value": null - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Waste" - }, - "properties": [ - { - "id": "unit", - "value": "decbytes" - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#3e668f", - "value": null - }, - { - "color": "#346f36cc", - "value": 100000000 - }, - { - "color": "#f5a673", - "value": 1000000000 - }, - { - "color": "#EAB839", - "value": 2000000000 - }, - { - "color": "red", - "value": 4000000000 - }, - { - "color": "#b783af", - "value": 8000000000 - } - ] - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Ratio" - }, - "properties": [ - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#3e668f", - "value": null - }, - { - "color": "#346f36cc", - "value": 0.1 - }, - { - "color": "#fcdb72", - "value": 0.3 - }, - { - "color": "#f5a673", - "value": 0.5 - }, - { - "color": "red", - "value": 0.7 - }, - { - "color": "#b783af", - "value": 0.9 - }, - { - "color": "text", - "value": 0.999 - } - ] - } - } - ] - } - ] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 45 - }, - "id": 191, - "options": { - "colorByField": "ratio", - "colorField": "ratio", - "sizeField": "size", - "textField": "relname", - "tiling": "treemapBinary" - }, - "pluginVersion": "7.5.4", - "targets": [ - { - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "${dsn}" - }, - "editorMode": "code", - "format": "table", - "hide": false, - "rawQuery": true, - "rawSql": "SELECT CURRENT_CATALOG AS datname, nspname, relname , tblid , bs * tblpages AS size,\n CASE WHEN tblpages - est_tblpages_ff > 0 THEN (tblpages - est_tblpages_ff)/tblpages::FLOAT ELSE 0 END AS ratio\nFROM (\n SELECT ceil( reltuples / ( (bs-page_hdr)*fillfactor/(tpl_size*100) ) ) + ceil( toasttuples / 4 ) AS est_tblpages_ff,\n tblpages, fillfactor, bs, tblid, nspname, relname, is_na\n FROM (\n SELECT\n ( 4 + tpl_hdr_size + tpl_data_size + (2 * ma)\n - CASE WHEN tpl_hdr_size % ma = 0 THEN ma ELSE tpl_hdr_size % ma END\n - CASE WHEN ceil(tpl_data_size)::INT % ma = 0 THEN ma ELSE ceil(tpl_data_size)::INT % ma END\n ) AS tpl_size, (heappages + toastpages) AS tblpages, heappages,\n toastpages, reltuples, toasttuples, bs, page_hdr, tblid, nspname, relname, fillfactor, is_na\n FROM (\n SELECT\n tbl.oid AS tblid, ns.nspname , tbl.relname, tbl.reltuples,\n tbl.relpages AS heappages, coalesce(toast.relpages, 0) AS toastpages,\n coalesce(toast.reltuples, 0) AS toasttuples,\n coalesce(substring(array_to_string(tbl.reloptions, ' ') FROM 'fillfactor=([0-9]+)')::smallint, 100) AS fillfactor,\n current_setting('block_size')::numeric AS bs,\n CASE WHEN version()~'mingw32' OR version()~'64-bit|x86_64|ppc64|ia64|amd64' THEN 8 ELSE 4 END AS ma,\n 24 AS page_hdr,\n 23 + CASE WHEN MAX(coalesce(s.null_frac,0)) > 0 THEN ( 7 + count(s.attname) ) / 8 ELSE 0::int END\n + CASE WHEN bool_or(att.attname = 'oid' and att.attnum < 0) THEN 4 ELSE 0 END AS tpl_hdr_size,\n sum( (1-coalesce(s.null_frac, 0)) * coalesce(s.avg_width, 0) ) AS tpl_data_size,\n bool_or(att.atttypid = 'pg_catalog.name'::regtype)\n OR sum(CASE WHEN att.attnum > 0 THEN 1 ELSE 0 END) <> count(s.attname) AS is_na\n FROM pg_attribute AS att\n JOIN pg_class AS tbl ON att.attrelid = tbl.oid\n JOIN pg_namespace AS ns ON ns.oid = tbl.relnamespace\n LEFT JOIN pg_stats AS s ON s.schemaname=ns.nspname AND s.tablename = tbl.relname AND s.inherited=false AND s.attname=att.attname\n LEFT JOIN pg_class AS toast ON tbl.reltoastrelid = toast.oid\n WHERE NOT att.attisdropped AND tbl.relkind = 'r' AND nspname = '$schema'\n GROUP BY tbl.oid, ns.nspname, tbl.relname, tbl.reltuples, tbl.relpages, toast.relpages, toast.reltuples, tbl.reloptions\n ) AS s\n ) AS s2\n ) AS s3\nWHERE NOT is_na;", - "refId": "A", - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - } - } - ], - "title": "Table Wasted Bytes", - "transformations": [ - { - "id": "organize", - "options": { - "excludeByName": {}, - "indexByName": { - "bloat_size": 4, - "datname": 0, - "nspname": 1, - "ratio": 5, - "relname": 2, - "size": 3 - }, - "renameByName": { - "bloat_size": "Waste", - "datname": "Database", - "nspname": "Schema", - "ratio": "Ratio", - "relname": "Relation", - "size": "Size", - "waste": "Waste" - } - } - } - ], - "type": "marcusolsson-treemap-panel" - }, - { - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "${dsn}" - }, - "description": "Bloat ratio & wasted bytes estimation of all btree indexes", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "center", - "cellOptions": { - "type": "auto" - }, - "filterable": false, - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "#346f36cc", - "value": null - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Relation" - }, - "properties": [ - { - "id": "custom.align", - "value": "left" - }, - { - "id": "links", - "value": [ - { - "title": "PGCAT Table for ${__data.fields.Relation} on ${ins}.${datname}", - "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Relation}" - } - ] - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Database" - }, - "properties": [ - { - "id": "custom.width", - "value": 160 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Size" - }, - "properties": [ - { - "id": "custom.width", - "value": 80 - }, - { - "id": "unit", - "value": "decbytes" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Ratio" - }, - "properties": [ - { - "id": "custom.width", - "value": 100 - }, - { - "id": "unit", - "value": "percentunit" - }, - { - "id": "decimals", - "value": 1 - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#3e668f", - "value": null - }, - { - "color": "#346f36cc", - "value": 0.1 - }, - { - "color": "#EAB839", - "value": 0.3 - }, - { - "color": "#f5a673", - "value": 0.5 - }, - { - "color": "red", - "value": 0.7 - }, - { - "color": "#b783af", - "value": 0.9 - }, - { - "color": "rgb(0, 0, 0)", - "value": 0.999 - } - ] - } - }, - { - "id": "custom.cellOptions", - "value": { - "mode": "gradient", - "type": "color-background" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Waste" - }, - "properties": [ - { - "id": "unit", - "value": "decbytes" - }, - { - "id": "custom.width", - "value": 100 - }, - { - "id": "custom.cellOptions", - "value": { - "mode": "gradient", - "type": "color-background" - } - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#3e668f", - "value": null - }, - { - "color": "#346f36cc", - "value": 100000000 - }, - { - "color": "#f5a673", - "value": 1000000000 - }, - { - "color": "#EAB839", - "value": 2000000000 - }, - { - "color": "red", - "value": 4000000000 - }, - { - "color": "#b783af", - "value": 8000000000 - } - ] - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "IndexID" - }, - "properties": [ - { - "id": "custom.width", - "value": 100 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "TableID" - }, - "properties": [ - { - "id": "custom.width", - "value": 100 - } - ] - } - ] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 0, - "y": 53 - }, - "id": 192, - "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] - }, - "pluginVersion": "11.1.4", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "${dsn}" - }, - "editorMode": "code", - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT CURRENT_CATALOG AS datname, nspname || '.' || idxname AS relname, tblid, idxid, relpages::BIGINT * bs AS size,\n COALESCE((relpages - ( reltuples * (6 + ma - (CASE WHEN index_tuple_hdr % ma = 0 THEN ma ELSE index_tuple_hdr % ma END)\n + nulldatawidth + ma - (CASE WHEN nulldatawidth % ma = 0 THEN ma ELSE nulldatawidth % ma END))\n / (bs - pagehdr)::FLOAT + 1 )), 0) / relpages::FLOAT AS ratio\nFROM (\n SELECT nspname,idxname,indrelid AS tblid,indexrelid AS idxid,\n reltuples,relpages,\n current_setting('block_size')::INTEGER AS bs,\n (CASE WHEN version() ~ 'mingw32' OR version() ~ '64-bit|x86_64|ppc64|ia64|amd64' THEN 8 ELSE 4 END) AS ma,\n 24 AS pagehdr,\n (CASE WHEN max(COALESCE(pg_stats.null_frac, 0)) = 0 THEN 2 ELSE 6 END) AS index_tuple_hdr,\n sum((1.0 - COALESCE(pg_stats.null_frac, 0.0)) *\n COALESCE(pg_stats.avg_width, 1024))::INTEGER AS nulldatawidth\n FROM pg_attribute\n JOIN (\n SELECT pg_namespace.nspname,\n ic.relname AS idxname,\n ic.reltuples,\n ic.relpages,\n pg_index.indrelid,\n pg_index.indexrelid,\n tc.relname AS tablename,\n regexp_split_to_table(pg_index.indkey::TEXT, ' ') :: INTEGER AS attnum,\n pg_index.indexrelid AS index_oid\n FROM pg_index\n JOIN pg_class ic ON pg_index.indexrelid = ic.oid\n JOIN pg_class tc ON pg_index.indrelid = tc.oid\n JOIN pg_namespace ON pg_namespace.oid = ic.relnamespace\n JOIN pg_am ON ic.relam = pg_am.oid\n WHERE pg_am.amname = 'btree' AND ic.relpages > 0 AND nspname = '$schema'\n ) ind_atts ON pg_attribute.attrelid = ind_atts.indexrelid AND pg_attribute.attnum = ind_atts.attnum\n JOIN pg_stats ON pg_stats.schemaname = ind_atts.nspname\n AND ((pg_stats.tablename = ind_atts.tablename AND pg_stats.attname = pg_get_indexdef(pg_attribute.attrelid, pg_attribute.attnum, TRUE))\n OR (pg_stats.tablename = ind_atts.idxname AND pg_stats.attname = pg_attribute.attname))\n WHERE pg_attribute.attnum > 0\n GROUP BY nspname,idxname,indrelid,indexrelid,reltuples,relpages\n ) est;", - "refId": "A", - "select": [ - [ - { - "params": [ - "probability" - ], - "type": "column" - } - ] - ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - }, - "table": "auto_suspicious_matches", - "timeColumn": "created_time", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Index Bloat", - "transformations": [ - { - "id": "organize", - "options": { - "excludeByName": {}, - "includeByName": {}, - "indexByName": { - "bloat_size": 4, - "datname": 0, - "nspname": 1, - "ratio": 5, - "relname": 2, - "size": 3 - }, - "renameByName": { - "bloat_size": "Waste", - "datname": "Database", - "idxid": "IndexID", - "nspname": "Schema", - "ratio": "Ratio", - "relname": "Relation", - "size": "Size", - "tblid": "TableID", - "waste": "Waste" - } - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "${dsn}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "links": [ + "pluginVersion": "11.1.4", + "targets": [ { - "title": "PGCAT Table for ${__data.fields.Relation} on ${ins}.${datname}", - "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Relation}" - } - ], - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "#346f36cc", - "value": null - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Waste" - }, - "properties": [ - { - "id": "unit", - "value": "decbytes" - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#3e668f", - "value": null - }, - { - "color": "#346f36cc", - "value": 100000000 - }, - { - "color": "#f5a673", - "value": 1000000000 - }, - { - "color": "#EAB839", - "value": 2000000000 - }, - { - "color": "red", - "value": 4000000000 - }, - { - "color": "#b783af", - "value": 8000000000 - } - ] - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Ratio" - }, - "properties": [ - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#3e668f", - "value": null - }, - { - "color": "#346f36cc", - "value": 0.1 - }, - { - "color": "#fcdb72", - "value": 0.3 - }, - { - "color": "#f5a673", - "value": 0.5 - }, - { - "color": "red", - "value": 0.7 - }, - { - "color": "#b783af", - "value": 0.9 + "datasource": { + "type": "postgres", + "uid": "${dsn}" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT * FROM monitor.pg_table_bloat;", + "refId": "A", + "select": [ + [ + { + "params": [ + "probability" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" }, - { - "color": "text", - "value": 0.999 - } - ] - } - } - ] - } - ] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 12, - "y": 53 - }, - "id": 193, - "options": { - "colorByField": "ratio", - "colorField": "ratio", - "sizeField": "size", - "textField": "relname", - "tiling": "treemapBinary" - }, - "pluginVersion": "7.5.4", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "${dsn}" - }, - "editorMode": "code", - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT CURRENT_CATALOG AS datname, nspname, idxname AS relname, tblid, idxid, relpages::BIGINT * bs AS size,\n COALESCE((relpages - ( reltuples * (6 + ma - (CASE WHEN index_tuple_hdr % ma = 0 THEN ma ELSE index_tuple_hdr % ma END)\n + nulldatawidth + ma - (CASE WHEN nulldatawidth % ma = 0 THEN ma ELSE nulldatawidth % ma END))\n / (bs - pagehdr)::FLOAT + 1 )), 0) / relpages::FLOAT AS ratio\nFROM (\n SELECT nspname,idxname,indrelid AS tblid,indexrelid AS idxid,\n reltuples,relpages,\n current_setting('block_size')::INTEGER AS bs,\n (CASE WHEN version() ~ 'mingw32' OR version() ~ '64-bit|x86_64|ppc64|ia64|amd64' THEN 8 ELSE 4 END) AS ma,\n 24 AS pagehdr,\n (CASE WHEN max(COALESCE(pg_stats.null_frac, 0)) = 0 THEN 2 ELSE 6 END) AS index_tuple_hdr,\n sum((1.0 - COALESCE(pg_stats.null_frac, 0.0)) *\n COALESCE(pg_stats.avg_width, 1024))::INTEGER AS nulldatawidth\n FROM pg_attribute\n JOIN (\n SELECT pg_namespace.nspname,\n ic.relname AS idxname,\n ic.reltuples,\n ic.relpages,\n pg_index.indrelid,\n pg_index.indexrelid,\n tc.relname AS tablename,\n regexp_split_to_table(pg_index.indkey::TEXT, ' ') :: INTEGER AS attnum,\n pg_index.indexrelid AS index_oid\n FROM pg_index\n JOIN pg_class ic ON pg_index.indexrelid = ic.oid\n JOIN pg_class tc ON pg_index.indrelid = tc.oid\n JOIN pg_namespace ON pg_namespace.oid = ic.relnamespace\n JOIN pg_am ON ic.relam = pg_am.oid\n WHERE pg_am.amname = 'btree' AND ic.relpages > 0 AND nspname = '$schema'\n ) ind_atts ON pg_attribute.attrelid = ind_atts.indexrelid AND pg_attribute.attnum = ind_atts.attnum\n JOIN pg_stats ON pg_stats.schemaname = ind_atts.nspname\n AND ((pg_stats.tablename = ind_atts.tablename AND pg_stats.attname = pg_get_indexdef(pg_attribute.attrelid, pg_attribute.attnum, TRUE))\n OR (pg_stats.tablename = ind_atts.idxname AND pg_stats.attname = pg_attribute.attname))\n WHERE pg_attribute.attnum > 0\n GROUP BY nspname,idxname,indrelid,indexrelid,reltuples,relpages\n ) est;", - "refId": "A", - "select": [ - [ - { - "params": [ - "probability" + "type": "groupBy" + } ], - "type": "column" - } - ] + "limit": 50 + }, + "table": "auto_suspicious_matches", + "timeColumn": "created_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" + "title": "Table Bloat", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": {}, + "includeByName": {}, + "indexByName": { + "bloat_size": 4, + "datname": 0, + "nspname": 1, + "ratio": 5, + "relname": 2, + "size": 3 }, - "type": "groupBy" + "renameByName": { + "bloat_size": "Waste", + "datname": "Database", + "nspname": "Schema", + "ratio": "Ratio", + "relname": "Relation", + "size": "Size", + "tblid": "TableID", + "waste": "Waste" + } } - ], - "limit": 50 - }, - "table": "auto_suspicious_matches", - "timeColumn": "created_time", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Index Wasted Bytes", - "transformations": [ - { - "id": "organize", - "options": { - "excludeByName": {}, - "indexByName": { - "bloat_size": 4, - "datname": 0, - "nspname": 1, - "ratio": 5, - "relname": 2, - "size": 3 - }, - "renameByName": { - "bloat_size": "Waste", - "datname": "Database", - "nspname": "Schema", - "ratio": "Ratio", - "relname": "Relation", - "size": "Size", - "waste": "Waste" } - } - } - ], - "type": "marcusolsson-treemap-panel" - }, - { - "collapsed": false, - "datasource": { - "type": "prometheus", - "uid": "ds-prometheus" - }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 63 - }, - "id": 156, - "panels": [], - "title": "Seq", - "type": "row" - }, - { - "datasource": { - "type": "postgres", - "uid": "${dsn}" - }, - "description": "", - "fieldConfig": { - "defaults": { - "custom": { - "align": "center", - "cellOptions": { - "type": "auto" - }, - "filterable": false, - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "#e3e3e3e0", - "value": null - } - ] - } + ], + "type": "table" }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Table" + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${dsn}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "links": [ + { + "title": "PGCAT Table for ${__data.fields.Relation} on ${ins}.${datname}", + "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Relation}" + } + ], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#346f36cc", + "value": null + } + ] + } }, - "properties": [ + "overrides": [ { - "id": "links", - "value": [ + "matcher": { + "id": "byName", + "options": "Waste" + }, + "properties": [ { - "title": "Relation detail for ${__data.fields.Table}", - "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Table}" + "id": "unit", + "value": "decbytes" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#3e668f", + "value": null + }, + { + "color": "#346f36cc", + "value": 100000000 + }, + { + "color": "#f5a673", + "value": 1000000000 + }, + { + "color": "#EAB839", + "value": 2000000000 + }, + { + "color": "red", + "value": 4000000000 + }, + { + "color": "#b783af", + "value": 8000000000 + } + ] + } } ] }, { - "id": "custom.align", - "value": "left" + "matcher": { + "id": "byName", + "options": "Ratio" + }, + "properties": [ + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#3e668f", + "value": null + }, + { + "color": "#346f36cc", + "value": 0.1 + }, + { + "color": "#fcdb72", + "value": 0.3 + }, + { + "color": "#f5a673", + "value": 0.5 + }, + { + "color": "red", + "value": 0.7 + }, + { + "color": "#b783af", + "value": 0.9 + }, + { + "color": "text", + "value": 0.999 + } + ] + } + } + ] } ] }, - { - "matcher": { - "id": "byName", - "options": "Sequence" + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 45 + }, + "id": 191, + "options": { + "colorByField": "ratio", + "colorField": "ratio", + "sizeField": "size", + "textField": "relname", + "tiling": "treemapBinary" + }, + "pluginVersion": "7.5.4", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${dsn}" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT * FROM monitor.pg_table_bloat;", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Table Wasted Bytes", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": {}, + "indexByName": { + "bloat_size": 4, + "datname": 0, + "nspname": 1, + "ratio": 5, + "relname": 2, + "size": 3 + }, + "renameByName": { + "bloat_size": "Waste", + "datname": "Database", + "nspname": "Schema", + "ratio": "Ratio", + "relname": "Relation", + "size": "Size", + "waste": "Waste" + } + } + } + ], + "type": "marcusolsson-treemap-panel" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${dsn}" + }, + "description": "Bloat ratio & wasted bytes estimation of all btree indexes", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "center", + "cellOptions": { + "type": "auto" + }, + "filterable": false, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#346f36cc", + "value": null + } + ] + } }, - "properties": [ + "overrides": [ { - "id": "links", - "value": [ + "matcher": { + "id": "byName", + "options": "Relation" + }, + "properties": [ { - "title": "PGCAT Seqeuence : ${__data.fields.Sequence}", - "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Sequence}" + "id": "custom.align", + "value": "left" + }, + { + "id": "links", + "value": [ + { + "title": "PGCAT Table for ${__data.fields.Relation} on ${ins}.${datname}", + "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Relation}" + } + ] } ] }, { - "id": "custom.minWidth", - "value": 360 + "matcher": { + "id": "byName", + "options": "Database" + }, + "properties": [ + { + "id": "custom.width", + "value": 160 + } + ] }, { - "id": "custom.align", - "value": "left" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Last Value" - }, - "properties": [ - { - "id": "mappings", - "value": [ + "matcher": { + "id": "byName", + "options": "Size" + }, + "properties": [ { - "options": { - "match": "null+nan", - "result": { - "color": "#80808080", - "index": 0 - } - }, - "type": "special" + "id": "custom.width", + "value": 80 + }, + { + "id": "unit", + "value": "decbytes" } ] }, { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } + "matcher": { + "id": "byName", + "options": "Ratio" + }, + "properties": [ + { + "id": "custom.width", + "value": 100 + }, + { + "id": "unit", + "value": "percentunit" + }, + { + "id": "decimals", + "value": 1 + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#3e668f", + "value": null + }, + { + "color": "#346f36cc", + "value": 0.1 + }, + { + "color": "#EAB839", + "value": 0.3 + }, + { + "color": "#f5a673", + "value": 0.5 + }, + { + "color": "red", + "value": 0.7 + }, + { + "color": "#b783af", + "value": 0.9 + }, + { + "color": "rgb(0, 0, 0)", + "value": 0.999 + } + ] + } + }, + { + "id": "custom.cellOptions", + "value": { + "mode": "gradient", + "type": "color-background" + } + } + ] }, { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "#3e668f", - "value": null + "matcher": { + "id": "byName", + "options": "Waste" + }, + "properties": [ + { + "id": "unit", + "value": "decbytes" + }, + { + "id": "custom.width", + "value": 100 + }, + { + "id": "custom.cellOptions", + "value": { + "mode": "gradient", + "type": "color-background" } - ] - } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#3e668f", + "value": null + }, + { + "color": "#346f36cc", + "value": 100000000 + }, + { + "color": "#f5a673", + "value": 1000000000 + }, + { + "color": "#EAB839", + "value": 2000000000 + }, + { + "color": "red", + "value": 4000000000 + }, + { + "color": "#b783af", + "value": 8000000000 + } + ] + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "IndexID" + }, + "properties": [ + { + "id": "custom.width", + "value": 100 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "TableID" + }, + "properties": [ + { + "id": "custom.width", + "value": 100 + } + ] } ] }, - { - "matcher": { - "id": "byName", - "options": "Cycle" + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 53 + }, + "id": 192, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false }, - "properties": [ + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "11.1.4", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "${dsn}" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT * FROM monitor.pg_index_bloat;", + "refId": "A", + "select": [ + [ + { + "params": [ + "probability" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "auto_suspicious_matches", + "timeColumn": "created_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Index Bloat", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": {}, + "includeByName": {}, + "indexByName": { + "bloat_size": 4, + "datname": 0, + "nspname": 1, + "ratio": 5, + "relname": 2, + "size": 3 + }, + "renameByName": { + "bloat_size": "Waste", + "datname": "Database", + "idxid": "IndexID", + "nspname": "Schema", + "ratio": "Ratio", + "relname": "Relation", + "size": "Size", + "tblid": "TableID", + "waste": "Waste" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${dsn}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "links": [ + { + "title": "PGCAT Table for ${__data.fields.Relation} on ${ins}.${datname}", + "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Relation}" + } + ], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#346f36cc", + "value": null + } + ] + } + }, + "overrides": [ { - "id": "custom.width", - "value": 80 + "matcher": { + "id": "byName", + "options": "Waste" + }, + "properties": [ + { + "id": "unit", + "value": "decbytes" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#3e668f", + "value": null + }, + { + "color": "#346f36cc", + "value": 100000000 + }, + { + "color": "#f5a673", + "value": 1000000000 + }, + { + "color": "#EAB839", + "value": 2000000000 + }, + { + "color": "red", + "value": 4000000000 + }, + { + "color": "#b783af", + "value": 8000000000 + } + ] + } + } + ] }, { - "id": "mappings", - "value": [ + "matcher": { + "id": "byName", + "options": "Ratio" + }, + "properties": [ + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#3e668f", + "value": null + }, + { + "color": "#346f36cc", + "value": 0.1 + }, + { + "color": "#fcdb72", + "value": 0.3 + }, + { + "color": "#f5a673", + "value": 0.5 + }, + { + "color": "red", + "value": 0.7 + }, + { + "color": "#b783af", + "value": 0.9 + }, + { + "color": "text", + "value": 0.999 + } + ] + } + } + ] + } + ] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 53 + }, + "id": 193, + "options": { + "colorByField": "ratio", + "colorField": "ratio", + "sizeField": "size", + "textField": "relname", + "tiling": "treemapBinary" + }, + "pluginVersion": "7.5.4", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "${dsn}" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT * FROM monitor.pg_index_bloat;", + "refId": "A", + "select": [ + [ + { + "params": [ + "probability" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "auto_suspicious_matches", + "timeColumn": "created_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Index Wasted Bytes", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": {}, + "indexByName": { + "bloat_size": 4, + "datname": 0, + "nspname": 1, + "ratio": 5, + "relname": 2, + "size": 3 + }, + "renameByName": { + "bloat_size": "Waste", + "datname": "Database", + "nspname": "Schema", + "ratio": "Ratio", + "relname": "Relation", + "size": "Size", + "waste": "Waste" + } + } + } + ], + "type": "marcusolsson-treemap-panel" + } + ], + "title": "Bloat", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "ds-prometheus" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 25 + }, + "id": 156, + "panels": [ + { + "datasource": { + "type": "postgres", + "uid": "${dsn}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "custom": { + "align": "center", + "cellOptions": { + "type": "auto" + }, + "filterable": false, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ { - "options": { - "false": { - "color": "#346f36cc", - "index": 0, - "text": "F" - }, - "true": { - "color": "#f5a673", - "index": 1, - "text": "T" - } - }, - "type": "value" + "color": "#e3e3e3e0", + "value": null } ] - }, - { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } - }, - { - "id": "custom.filterable", - "value": true - } - ] - }, - { - "matcher": { - "id": "byType", - "options": "number" - }, - "properties": [ - { - "id": "custom.width", - "value": 120 } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Owner" }, - "properties": [ + "overrides": [ { - "id": "custom.width", - "value": 120 + "matcher": { + "id": "byName", + "options": "Table" + }, + "properties": [ + { + "id": "links", + "value": [ + { + "title": "Relation detail for ${__data.fields.Table}", + "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Table}" + } + ] + }, + { + "id": "custom.align", + "value": "left" + } + ] }, { - "id": "custom.filterable", - "value": true - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Type" - }, - "properties": [ + "matcher": { + "id": "byName", + "options": "Sequence" + }, + "properties": [ + { + "id": "links", + "value": [ + { + "title": "PGCAT Seqeuence : ${__data.fields.Sequence}", + "url": "/d/pgcat-table?var-dsn=${dsn}&var-relname=${__data.fields.Sequence}" + } + ] + }, + { + "id": "custom.minWidth", + "value": 360 + }, + { + "id": "custom.align", + "value": "left" + } + ] + }, { - "id": "custom.width", - "value": 110 + "matcher": { + "id": "byName", + "options": "Last Value" + }, + "properties": [ + { + "id": "mappings", + "value": [ + { + "options": { + "match": "null+nan", + "result": { + "color": "#80808080", + "index": 0 + } + }, + "type": "special" + } + ] + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "#3e668f", + "value": null + } + ] + } + } + ] }, { - "id": "mappings", - "value": [ + "matcher": { + "id": "byName", + "options": "Cycle" + }, + "properties": [ { - "options": { - "bigint": { - "color": "#346f36cc", - "index": 2, - "text": "BIGINT(8)" - }, - "integer": { - "color": "#5b9cd5", - "index": 0, - "text": "INTEGER(4)" - }, - "smallint": { - "color": "#3e668f", - "index": 1, - "text": "SMALLINT(2)" + "id": "custom.width", + "value": 80 + }, + { + "id": "mappings", + "value": [ + { + "options": { + "false": { + "color": "#346f36cc", + "index": 0, + "text": "F" + }, + "true": { + "color": "#f5a673", + "index": 1, + "text": "T" + } + }, + "type": "value" } - }, - "type": "value" + ] + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "custom.filterable", + "value": true } ] }, { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } + "matcher": { + "id": "byType", + "options": "number" + }, + "properties": [ + { + "id": "custom.width", + "value": 120 + } + ] }, { - "id": "custom.filterable", - "value": true - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Schema" - }, - "properties": [ + "matcher": { + "id": "byName", + "options": "Owner" + }, + "properties": [ + { + "id": "custom.width", + "value": 120 + }, + { + "id": "custom.filterable", + "value": true + } + ] + }, { - "id": "custom.minWidth", - "value": 120 + "matcher": { + "id": "byName", + "options": "Type" + }, + "properties": [ + { + "id": "custom.width", + "value": 110 + }, + { + "id": "mappings", + "value": [ + { + "options": { + "bigint": { + "color": "#346f36cc", + "index": 2, + "text": "BIGINT(8)" + }, + "integer": { + "color": "#5b9cd5", + "index": 0, + "text": "INTEGER(4)" + }, + "smallint": { + "color": "#3e668f", + "index": 1, + "text": "SMALLINT(2)" + } + }, + "type": "value" + } + ] + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "custom.filterable", + "value": true + } + ] }, { - "id": "links", - "value": [ + "matcher": { + "id": "byName", + "options": "Schema" + }, + "properties": [ { - "title": "PGCAT Schema : ${dsn}.${schema}", - "url": "/d/pgcat-schema?var-dsn=${dsn}&var-schema=${__data.fields.Schema}&${__url_time_range}" + "id": "custom.minWidth", + "value": 120 + }, + { + "id": "links", + "value": [ + { + "title": "PGCAT Schema : ${dsn}.${schema}", + "url": "/d/pgcat-schema?var-dsn=${dsn}&var-schema=${__data.fields.Schema}&${__url_time_range}" + } + ] } ] } ] - } - ] - }, - "gridPos": { - "h": 5, - "w": 24, - "x": 0, - "y": 64 - }, - "id": 194, - "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [ - { - "desc": false, - "displayName": "Sequence" - } - ] - }, - "pluginVersion": "11.1.4", - "targets": [ - { - "datasource": { - "type": "postgres", - "uid": "${dsn}" }, - "editorMode": "code", - "format": "table", - "group": [], - "metricColumn": "none", - "rawQuery": true, - "rawSql": "SELECT schemaname || '.' || sequencename AS \"Sequence\", *\nFROM pg_sequences\nWHERE schemaname = '$schema';", - "refId": "A", - "select": [ - [ + "gridPos": { + "h": 5, + "w": 24, + "x": 0, + "y": 64 + }, + "id": 194, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [ { - "params": [ - "value" - ], - "type": "column" + "desc": false, + "displayName": "Sequence" } ] - ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 }, - "timeColumn": "time", - "where": [ + "pluginVersion": "11.1.4", + "targets": [ { - "name": "$__timeFilter", - "params": [], - "type": "macro" + "datasource": { + "type": "postgres", + "uid": "${dsn}" + }, + "editorMode": "code", + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT schemaname || '.' || sequencename AS \"Sequence\", *\nFROM pg_sequences\nWHERE schemaname = '$schema';", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] } - ] - } - ], - "transformations": [ - { - "id": "organize", - "options": { - "excludeByName": { - "indexrelname": true, - "max_value": true, - "min_value": true, - "relname": true, - "schemaname": true, - "sequencename": true - }, - "indexByName": { - "Sequence": 0, - "cache_size": 10, - "cycle": 9, - "data_type": 3, - "increment_by": 8, - "last_value": 4, - "max_value": 7, - "min_value": 6, - "schemaname": 1, - "sequencename": 11, - "sequenceowner": 2, - "start_value": 5 - }, - "renameByName": { - "Index": "Index", - "Name": "Name", - "Sequence": "Sequence", - "Table": "Table", - "cache_size": "Cache Size", - "cycle": "Cycle", - "data_type": "Type", - "def": "Define", - "idx_scan": "Scan", - "idx_tup_fetch": "Tup Fetch", - "idx_tup_read": "Tup Read", - "increment_by": "Increment By", - "indexrelid": "Index ID", - "indexrelname": "", - "last_value": "Last Value", - "max_value": "Max", - "min_value": "Min", - "relid": "Table ID", - "relname": "", - "schemaname": "Schema", - "sequenceowner": "Owner", - "start_value": "Start" + ], + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": { + "indexrelname": true, + "max_value": true, + "min_value": true, + "relname": true, + "schemaname": true, + "sequencename": true + }, + "indexByName": { + "Sequence": 0, + "cache_size": 10, + "cycle": 9, + "data_type": 3, + "increment_by": 8, + "last_value": 4, + "max_value": 7, + "min_value": 6, + "schemaname": 1, + "sequencename": 11, + "sequenceowner": 2, + "start_value": 5 + }, + "renameByName": { + "Index": "Index", + "Name": "Name", + "Sequence": "Sequence", + "Table": "Table", + "cache_size": "Cache Size", + "cycle": "Cycle", + "data_type": "Type", + "def": "Define", + "idx_scan": "Scan", + "idx_tup_fetch": "Tup Fetch", + "idx_tup_read": "Tup Read", + "increment_by": "Increment By", + "indexrelid": "Index ID", + "indexrelname": "", + "last_value": "Last Value", + "max_value": "Max", + "min_value": "Min", + "relid": "Table ID", + "relname": "", + "schemaname": "Schema", + "sequenceowner": "Owner", + "start_value": "Start" + } + } } - } + ], + "type": "table" } ], - "type": "table" + "title": "Seq", + "type": "row" } ], "refresh": "",