unoffical wafrn mirror
wafrn.net
atproto
social-network
activitypub
1{
2 "annotations": {
3 "list": [
4 {
5 "builtIn": 1,
6 "datasource": {
7 "type": "datasource",
8 "uid": "grafana"
9 },
10 "enable": true,
11 "hide": true,
12 "iconColor": "rgba(0, 211, 255, 1)",
13 "name": "Annotations & Alerts",
14 "type": "dashboard"
15 }
16 ]
17 },
18 "description": "For one query",
19 "editable": true,
20 "fiscalYearStartMonth": 0,
21 "graphTooltip": 0,
22 "links": [],
23 "panels": [
24 {
25 "datasource": {
26 "type": "grafana-postgresql-datasource",
27 "uid": "pgwatch-metrics"
28 },
29 "fieldConfig": {
30 "defaults": {
31 "color": {
32 "mode": "palette-classic"
33 },
34 "custom": {
35 "axisBorderShow": false,
36 "axisCenteredZero": false,
37 "axisColorMode": "text",
38 "axisGridShow": true,
39 "axisLabel": "",
40 "axisPlacement": "auto",
41 "barAlignment": 0,
42 "drawStyle": "line",
43 "fillOpacity": 10,
44 "gradientMode": "none",
45 "hideFrom": {
46 "legend": false,
47 "tooltip": false,
48 "viz": false
49 },
50 "insertNulls": false,
51 "lineInterpolation": "linear",
52 "lineWidth": 1,
53 "pointSize": 5,
54 "scaleDistribution": {
55 "type": "linear"
56 },
57 "showPoints": "never",
58 "spanNulls": true,
59 "stacking": {
60 "group": "A",
61 "mode": "none"
62 },
63 "thresholdsStyle": {
64 "mode": "off"
65 }
66 },
67 "mappings": [],
68 "min": 0,
69 "thresholds": {
70 "mode": "absolute",
71 "steps": [
72 {
73 "color": "green",
74 "value": null
75 },
76 {
77 "color": "red",
78 "value": 80
79 }
80 ]
81 },
82 "unit": "ms"
83 },
84 "overrides": []
85 },
86 "gridPos": {
87 "h": 5,
88 "w": 24,
89 "x": 0,
90 "y": 0
91 },
92 "id": 3,
93 "interval": "5m",
94 "options": {
95 "legend": {
96 "calcs": [
97 "mean"
98 ],
99 "displayMode": "list",
100 "placement": "bottom",
101 "showLegend": true
102 },
103 "tooltip": {
104 "mode": "multi",
105 "sort": "none"
106 }
107 },
108 "pluginVersion": "10.4.1",
109 "targets": [
110 {
111 "alias": "avg_runtime",
112 "datasource": {
113 "type": "grafana-postgresql-datasource",
114 "uid": "pgwatch-metrics"
115 },
116 "format": "time_series",
117 "group": [],
118 "groupBy": [
119 {
120 "params": [
121 "$interval"
122 ],
123 "type": "time"
124 },
125 {
126 "params": [
127 "null"
128 ],
129 "type": "fill"
130 }
131 ],
132 "measurement": "stat_statements",
133 "metricColumn": "none",
134 "orderByTime": "ASC",
135 "policy": "default",
136 "query": "SELECT non_negative_derivative(mean(\"total_time\")) / non_negative_derivative(mean(\"calls\")) FROM \"stat_statements\" WHERE \"queryid\" =~ /^$queryid$/ AND $timeFilter GROUP BY time($__interval), \"queryid\" fill(null)",
137 "rawQuery": true,
138 "rawSql": "select\n $__timeGroup(time, $agg_interval),\n avg(case when c = c_lag then null else (tt - tt_lag) / (c - c_lag) end) as avg_runtime\nfrom (\n select \n (data->>'calls')::int8 as c, lag((data->>'calls')::int8) over w as c_lag,\n (data->>'total_time')::float8 as tt, lag((data->>'total_time')::float8) over w as tt_lag,\n time\n from stat_statements\n where dbname = '$dbname' and tag_data @> '{\"queryid\": \"$queryid\"}' and $__timeFilter(time)\n window w as (order by time) \n) x\nwhere c >= c_lag\ngroup by 1\norder by 1",
139 "refId": "A",
140 "resultFormat": "time_series",
141 "select": [
142 [
143 {
144 "params": [
145 "total_time"
146 ],
147 "type": "field"
148 },
149 {
150 "params": [],
151 "type": "mean"
152 },
153 {
154 "params": [
155 "1h"
156 ],
157 "type": "non_negative_derivative"
158 }
159 ]
160 ],
161 "tags": [
162 {
163 "key": "queryid",
164 "operator": "=~",
165 "value": "/^$queryid$/"
166 }
167 ],
168 "timeColumn": "time",
169 "where": [
170 {
171 "name": "$__timeFilter",
172 "params": [],
173 "type": "macro"
174 }
175 ]
176 }
177 ],
178 "title": "Avg. runtime ($agg_interval avg.)",
179 "type": "timeseries"
180 },
181 {
182 "datasource": {
183 "type": "grafana-postgresql-datasource",
184 "uid": "pgwatch-metrics"
185 },
186 "fieldConfig": {
187 "defaults": {
188 "color": {
189 "mode": "palette-classic"
190 },
191 "custom": {
192 "axisBorderShow": false,
193 "axisCenteredZero": false,
194 "axisColorMode": "text",
195 "axisLabel": "",
196 "axisPlacement": "auto",
197 "barAlignment": 0,
198 "drawStyle": "line",
199 "fillOpacity": 10,
200 "gradientMode": "none",
201 "hideFrom": {
202 "legend": false,
203 "tooltip": false,
204 "viz": false
205 },
206 "insertNulls": false,
207 "lineInterpolation": "linear",
208 "lineWidth": 1,
209 "pointSize": 5,
210 "scaleDistribution": {
211 "type": "linear"
212 },
213 "showPoints": "never",
214 "spanNulls": false,
215 "stacking": {
216 "group": "A",
217 "mode": "none"
218 },
219 "thresholdsStyle": {
220 "mode": "off"
221 }
222 },
223 "mappings": [],
224 "thresholds": {
225 "mode": "absolute",
226 "steps": [
227 {
228 "color": "green",
229 "value": null
230 },
231 {
232 "color": "red",
233 "value": 80
234 }
235 ]
236 },
237 "unit": "short"
238 },
239 "overrides": []
240 },
241 "gridPos": {
242 "h": 5,
243 "w": 24,
244 "x": 0,
245 "y": 5
246 },
247 "id": 2,
248 "interval": "5m",
249 "options": {
250 "legend": {
251 "calcs": [
252 "mean"
253 ],
254 "displayMode": "list",
255 "placement": "bottom",
256 "showLegend": true
257 },
258 "tooltip": {
259 "mode": "multi",
260 "sort": "none"
261 }
262 },
263 "pluginVersion": "10.4.1",
264 "targets": [
265 {
266 "alias": "calls",
267 "datasource": {
268 "type": "grafana-postgresql-datasource",
269 "uid": "pgwatch-metrics"
270 },
271 "format": "time_series",
272 "group": [],
273 "groupBy": [
274 {
275 "params": [
276 "$__interval"
277 ],
278 "type": "time"
279 },
280 {
281 "params": [
282 "queryid"
283 ],
284 "type": "tag"
285 },
286 {
287 "params": [
288 "null"
289 ],
290 "type": "fill"
291 }
292 ],
293 "measurement": "stat_statements",
294 "metricColumn": "none",
295 "orderByTime": "ASC",
296 "policy": "default",
297 "rawQuery": true,
298 "rawSql": "select\n $__timeGroup(time, $agg_interval),\n sum(c - c_lag) as \"calls\"\nfrom (\n select \n (data->>'calls')::int8 as c, lag((data->>'calls')::int8) over w as c_lag,\n time, lag(time) over w as time_lag\n from stat_statements\n where dbname = '$dbname' and tag_data @> '{\"queryid\": \"$queryid\"}' and $__timeFilter(time)\n window w as (order by time) \n) x\nwhere c >= c_lag\ngroup by 1\norder by 1",
299 "refId": "A",
300 "resultFormat": "time_series",
301 "select": [
302 [
303 {
304 "params": [
305 "calls"
306 ],
307 "type": "field"
308 },
309 {
310 "params": [],
311 "type": "mean"
312 },
313 {
314 "params": [
315 "$rate_unit"
316 ],
317 "type": "non_negative_derivative"
318 }
319 ]
320 ],
321 "tags": [
322 {
323 "key": "queryid",
324 "operator": "=~",
325 "value": "/^$queryid$/"
326 }
327 ],
328 "timeColumn": "time",
329 "where": [
330 {
331 "name": "$__timeFilter",
332 "params": [],
333 "type": "macro"
334 }
335 ]
336 }
337 ],
338 "title": "Calls ($agg_interval aggregate)",
339 "type": "timeseries"
340 },
341 {
342 "datasource": {
343 "type": "grafana-postgresql-datasource",
344 "uid": "pgwatch-metrics"
345 },
346 "fieldConfig": {
347 "defaults": {
348 "color": {
349 "mode": "palette-classic"
350 },
351 "custom": {
352 "axisBorderShow": false,
353 "axisCenteredZero": false,
354 "axisColorMode": "text",
355 "axisLabel": "",
356 "axisPlacement": "auto",
357 "barAlignment": 0,
358 "drawStyle": "line",
359 "fillOpacity": 10,
360 "gradientMode": "none",
361 "hideFrom": {
362 "legend": false,
363 "tooltip": false,
364 "viz": false
365 },
366 "insertNulls": false,
367 "lineInterpolation": "linear",
368 "lineWidth": 1,
369 "pointSize": 5,
370 "scaleDistribution": {
371 "type": "linear"
372 },
373 "showPoints": "never",
374 "spanNulls": false,
375 "stacking": {
376 "group": "A",
377 "mode": "none"
378 },
379 "thresholdsStyle": {
380 "mode": "off"
381 }
382 },
383 "mappings": [],
384 "min": 0,
385 "thresholds": {
386 "mode": "absolute",
387 "steps": [
388 {
389 "color": "green",
390 "value": null
391 },
392 {
393 "color": "red",
394 "value": 80
395 }
396 ]
397 },
398 "unit": "ms"
399 },
400 "overrides": []
401 },
402 "gridPos": {
403 "h": 5,
404 "w": 24,
405 "x": 0,
406 "y": 10
407 },
408 "id": 1,
409 "interval": "5m",
410 "options": {
411 "legend": {
412 "calcs": [
413 "mean"
414 ],
415 "displayMode": "list",
416 "placement": "bottom",
417 "showLegend": true
418 },
419 "tooltip": {
420 "mode": "multi",
421 "sort": "none"
422 }
423 },
424 "pluginVersion": "10.4.1",
425 "targets": [
426 {
427 "alias": "total_runtime",
428 "datasource": {
429 "type": "grafana-postgresql-datasource",
430 "uid": "pgwatch-metrics"
431 },
432 "format": "time_series",
433 "group": [],
434 "groupBy": [
435 {
436 "params": [
437 "$__interval"
438 ],
439 "type": "time"
440 },
441 {
442 "params": [
443 "queryid"
444 ],
445 "type": "tag"
446 },
447 {
448 "params": [
449 "null"
450 ],
451 "type": "fill"
452 }
453 ],
454 "measurement": "stat_statements",
455 "metricColumn": "none",
456 "orderByTime": "ASC",
457 "policy": "default",
458 "rawQuery": true,
459 "rawSql": "select\n $__timeGroup(time, $agg_interval),\n sum(case when tt = tt_lag then null else tt - tt_lag end) as \"total_time\"\nfrom (\n select\n time,\n (data->>'total_time')::float8 as tt, lag((data->>'total_time')::float8) over w as tt_lag\n from stat_statements\n where dbname = '$dbname' and tag_data @> '{\"queryid\": \"$queryid\"}'and $__timeFilter(time)\n window w as (order by time) \n) x\nwhere tt >= tt_lag\ngroup by 1\norder by 1",
460 "refId": "A",
461 "resultFormat": "time_series",
462 "select": [
463 [
464 {
465 "params": [
466 "total_time"
467 ],
468 "type": "field"
469 },
470 {
471 "params": [],
472 "type": "mean"
473 },
474 {
475 "params": [
476 "$rate_unit"
477 ],
478 "type": "non_negative_derivative"
479 }
480 ]
481 ],
482 "tags": [
483 {
484 "key": "queryid",
485 "operator": "=~",
486 "value": "/^$queryid$/"
487 }
488 ],
489 "timeColumn": "time",
490 "where": [
491 {
492 "name": "$__timeFilter",
493 "params": [],
494 "type": "macro"
495 }
496 ]
497 }
498 ],
499 "title": "Total runtime ($agg_interval aggregate)",
500 "type": "timeseries"
501 },
502 {
503 "datasource": {
504 "type": "grafana-postgresql-datasource",
505 "uid": "pgwatch-metrics"
506 },
507 "fieldConfig": {
508 "defaults": {
509 "color": {
510 "mode": "palette-classic"
511 },
512 "custom": {
513 "axisBorderShow": false,
514 "axisCenteredZero": false,
515 "axisColorMode": "text",
516 "axisLabel": "",
517 "axisPlacement": "auto",
518 "barAlignment": 0,
519 "drawStyle": "line",
520 "fillOpacity": 10,
521 "gradientMode": "none",
522 "hideFrom": {
523 "legend": false,
524 "tooltip": false,
525 "viz": false
526 },
527 "insertNulls": false,
528 "lineInterpolation": "linear",
529 "lineWidth": 1,
530 "pointSize": 5,
531 "scaleDistribution": {
532 "type": "linear"
533 },
534 "showPoints": "never",
535 "spanNulls": true,
536 "stacking": {
537 "group": "A",
538 "mode": "none"
539 },
540 "thresholdsStyle": {
541 "mode": "off"
542 }
543 },
544 "mappings": [],
545 "min": 0,
546 "thresholds": {
547 "mode": "absolute",
548 "steps": [
549 {
550 "color": "green",
551 "value": null
552 },
553 {
554 "color": "red",
555 "value": 80
556 }
557 ]
558 },
559 "unit": "short"
560 },
561 "overrides": []
562 },
563 "gridPos": {
564 "h": 5,
565 "w": 24,
566 "x": 0,
567 "y": 15
568 },
569 "id": 4,
570 "interval": "5m",
571 "options": {
572 "legend": {
573 "calcs": [
574 "mean"
575 ],
576 "displayMode": "list",
577 "placement": "bottom",
578 "showLegend": true
579 },
580 "tooltip": {
581 "mode": "multi",
582 "sort": "none"
583 }
584 },
585 "pluginVersion": "10.4.1",
586 "targets": [
587 {
588 "alias": "sb_hit_ratio",
589 "datasource": {
590 "type": "grafana-postgresql-datasource",
591 "uid": "pgwatch-metrics"
592 },
593 "format": "time_series",
594 "group": [],
595 "groupBy": [
596 {
597 "params": [
598 "$interval"
599 ],
600 "type": "time"
601 },
602 {
603 "params": [
604 "null"
605 ],
606 "type": "fill"
607 }
608 ],
609 "measurement": "stat_statements",
610 "metricColumn": "none",
611 "orderByTime": "ASC",
612 "policy": "default",
613 "query": "SELECT non_negative_derivative(mean(\"shared_blks_hit\")) / (non_negative_derivative(mean(\"shared_blks_hit\")) + non_negative_derivative(mean(\"shared_blks_read\"))) * 100 FROM \"stat_statements\" WHERE \"queryid\" =~ /^$queryid$/ AND $timeFilter GROUP BY time($__interval), \"queryid\" fill(null)",
614 "rawQuery": true,
615 "rawSql": "select\n $__timeGroup(time, $agg_interval),\n avg(case when hit = hit_lag and read = read_lag then null else ((hit-hit_lag)::numeric * 100) / ((hit-hit_lag) + (read-read_lag)) end) as \"sb_hit_ratio\"\nfrom (\n select \n (data->'shared_blks_hit')::int8 as hit, lag((data->'shared_blks_hit')::int8) over w as hit_lag,\n (data->'shared_blks_read')::int8 as read, lag((data->'shared_blks_read')::int8) over w as read_lag,\n time\n from stat_statements\n where dbname = '$dbname' and $__timeFilter(time) and tag_data @> '{\"queryid\": \"$queryid\"}'\n window w as (order by time)\n) x\nwhere hit >= hit_lag and read >= read_lag\ngroup by 1\norder by 1",
616 "refId": "A",
617 "resultFormat": "time_series",
618 "select": [
619 [
620 {
621 "params": [
622 "shared_blks_hit"
623 ],
624 "type": "field"
625 },
626 {
627 "params": [],
628 "type": "mean"
629 },
630 {
631 "params": [
632 "1h"
633 ],
634 "type": "non_negative_derivative"
635 }
636 ]
637 ],
638 "tags": [
639 {
640 "key": "queryid",
641 "operator": "=~",
642 "value": "/^$queryid$/"
643 }
644 ],
645 "timeColumn": "time",
646 "where": [
647 {
648 "name": "$__timeFilter",
649 "params": [],
650 "type": "macro"
651 }
652 ]
653 }
654 ],
655 "title": "Shared Buffers Hit Ratio",
656 "type": "timeseries"
657 },
658 {
659 "datasource": {
660 "type": "grafana-postgresql-datasource",
661 "uid": "pgwatch-metrics"
662 },
663 "fieldConfig": {
664 "defaults": {
665 "color": {
666 "mode": "palette-classic"
667 },
668 "custom": {
669 "axisBorderShow": false,
670 "axisCenteredZero": false,
671 "axisColorMode": "text",
672 "axisLabel": "",
673 "axisPlacement": "auto",
674 "barAlignment": 0,
675 "drawStyle": "line",
676 "fillOpacity": 10,
677 "gradientMode": "none",
678 "hideFrom": {
679 "legend": false,
680 "tooltip": false,
681 "viz": false
682 },
683 "insertNulls": false,
684 "lineInterpolation": "linear",
685 "lineWidth": 1,
686 "pointSize": 5,
687 "scaleDistribution": {
688 "type": "linear"
689 },
690 "showPoints": "never",
691 "spanNulls": false,
692 "stacking": {
693 "group": "A",
694 "mode": "none"
695 },
696 "thresholdsStyle": {
697 "mode": "off"
698 }
699 },
700 "mappings": [],
701 "min": 0,
702 "thresholds": {
703 "mode": "absolute",
704 "steps": [
705 {
706 "color": "green",
707 "value": null
708 },
709 {
710 "color": "red",
711 "value": 80
712 }
713 ]
714 },
715 "unit": "short"
716 },
717 "overrides": []
718 },
719 "gridPos": {
720 "h": 5,
721 "w": 24,
722 "x": 0,
723 "y": 20
724 },
725 "id": 5,
726 "interval": "5m",
727 "options": {
728 "legend": {
729 "calcs": [],
730 "displayMode": "list",
731 "placement": "bottom",
732 "showLegend": true
733 },
734 "tooltip": {
735 "mode": "multi",
736 "sort": "none"
737 }
738 },
739 "pluginVersion": "10.4.1",
740 "targets": [
741 {
742 "alias": "temp_blks_written",
743 "datasource": {
744 "type": "grafana-postgresql-datasource",
745 "uid": "pgwatch-metrics"
746 },
747 "format": "time_series",
748 "group": [],
749 "groupBy": [
750 {
751 "params": [
752 "$__interval"
753 ],
754 "type": "time"
755 },
756 {
757 "params": [
758 "queryid"
759 ],
760 "type": "tag"
761 },
762 {
763 "params": [
764 "null"
765 ],
766 "type": "fill"
767 }
768 ],
769 "measurement": "stat_statements",
770 "metricColumn": "none",
771 "orderByTime": "ASC",
772 "policy": "default",
773 "rawQuery": true,
774 "rawSql": "select\n $__timeGroup(time, $agg_interval),\n sum(read-read_lag) as \"temp_blks_read\",\n sum(written-written_lag) as \"temp_blks_written\"\nfrom (\n select \n (data->'temp_blks_read')::int8 as read, lag((data->'temp_blks_read')::int8) over w as read_lag,\n (data->'temp_blks_written')::int8 as written, lag((data->'temp_blks_written')::int8) over w as written_lag,\n time\n from stat_statements\n where dbname = '$dbname' and $__timeFilter(time) and tag_data @> '{\"queryid\": \"$queryid\"}'\n window w as (order by time)\n) x\nwhere read >= read_lag and written >= written_lag\ngroup by 1\norder by 1",
775 "refId": "A",
776 "resultFormat": "time_series",
777 "select": [
778 [
779 {
780 "params": [
781 "temp_blks_written"
782 ],
783 "type": "field"
784 },
785 {
786 "params": [],
787 "type": "mean"
788 },
789 {
790 "params": [
791 "$rate_unit"
792 ],
793 "type": "non_negative_derivative"
794 }
795 ]
796 ],
797 "tags": [
798 {
799 "key": "queryid",
800 "operator": "=~",
801 "value": "/^$queryid$/"
802 }
803 ],
804 "timeColumn": "time",
805 "where": [
806 {
807 "name": "$__timeFilter",
808 "params": [],
809 "type": "macro"
810 }
811 ]
812 }
813 ],
814 "title": "Temp Blocks Read/Written ($agg_interval aggregate)",
815 "type": "timeseries"
816 },
817 {
818 "datasource": {
819 "type": "grafana-postgresql-datasource",
820 "uid": "pgwatch-metrics"
821 },
822 "description": "FYI - blk_write_time can easily be 0 as normally changes happen only in the shared buffers and are written out by the checkpointer / background writer.",
823 "fieldConfig": {
824 "defaults": {
825 "color": {
826 "mode": "palette-classic"
827 },
828 "custom": {
829 "axisBorderShow": false,
830 "axisCenteredZero": false,
831 "axisColorMode": "text",
832 "axisLabel": "",
833 "axisPlacement": "auto",
834 "barAlignment": 0,
835 "drawStyle": "line",
836 "fillOpacity": 10,
837 "gradientMode": "none",
838 "hideFrom": {
839 "legend": false,
840 "tooltip": false,
841 "viz": false
842 },
843 "insertNulls": false,
844 "lineInterpolation": "linear",
845 "lineWidth": 1,
846 "pointSize": 5,
847 "scaleDistribution": {
848 "type": "linear"
849 },
850 "showPoints": "never",
851 "spanNulls": false,
852 "stacking": {
853 "group": "A",
854 "mode": "none"
855 },
856 "thresholdsStyle": {
857 "mode": "off"
858 }
859 },
860 "mappings": [],
861 "min": 0,
862 "thresholds": {
863 "mode": "absolute",
864 "steps": [
865 {
866 "color": "green",
867 "value": null
868 },
869 {
870 "color": "red",
871 "value": 80
872 }
873 ]
874 },
875 "unit": "ms"
876 },
877 "overrides": []
878 },
879 "gridPos": {
880 "h": 5,
881 "w": 24,
882 "x": 0,
883 "y": 25
884 },
885 "id": 6,
886 "interval": "5m",
887 "options": {
888 "legend": {
889 "calcs": [
890 "mean"
891 ],
892 "displayMode": "list",
893 "placement": "bottom",
894 "showLegend": true
895 },
896 "tooltip": {
897 "mode": "multi",
898 "sort": "desc"
899 }
900 },
901 "pluginVersion": "10.4.1",
902 "targets": [
903 {
904 "alias": "blk_read_time",
905 "datasource": {
906 "type": "grafana-postgresql-datasource",
907 "uid": "pgwatch-metrics"
908 },
909 "format": "time_series",
910 "group": [],
911 "groupBy": [
912 {
913 "params": [
914 "$__interval"
915 ],
916 "type": "time"
917 },
918 {
919 "params": [
920 "queryid"
921 ],
922 "type": "tag"
923 },
924 {
925 "params": [
926 "null"
927 ],
928 "type": "fill"
929 }
930 ],
931 "measurement": "stat_statements",
932 "metricColumn": "none",
933 "orderByTime": "ASC",
934 "policy": "default",
935 "rawQuery": true,
936 "rawSql": "select\n $__timeGroup(time, $agg_interval),\n sum(read-read_lag) as \"blk_read_time\",\n sum(write-write_lag) as \"blk_write_time\"\nfrom (\n select \n (data->'blk_read_time')::int8 as read, lag((data->'blk_read_time')::int8) over w as read_lag,\n (data->'blk_write_time')::int8 as write, lag((data->'blk_write_time')::int8) over w as write_lag,\n time\n from stat_statements\n where dbname = '$dbname' and $__timeFilter(time) and tag_data @> '{\"queryid\": \"$queryid\"}'\n window w as (order by time)\n) x\nwhere read >= read_lag and write>= write_lag\ngroup by 1\norder by 1",
937 "refId": "A",
938 "resultFormat": "time_series",
939 "select": [
940 [
941 {
942 "params": [
943 "blk_read_time"
944 ],
945 "type": "field"
946 },
947 {
948 "params": [],
949 "type": "mean"
950 },
951 {
952 "params": [
953 "$rate_unit"
954 ],
955 "type": "non_negative_derivative"
956 }
957 ]
958 ],
959 "tags": [
960 {
961 "key": "queryid",
962 "operator": "=~",
963 "value": "/^$queryid$/"
964 }
965 ],
966 "timeColumn": "time",
967 "where": [
968 {
969 "name": "$__timeFilter",
970 "params": [],
971 "type": "macro"
972 }
973 ]
974 }
975 ],
976 "title": "Backend block Read/Write time ($agg_interval aggregate)",
977 "type": "timeseries"
978 },
979 {
980 "datasource": {
981 "type": "grafana-postgresql-datasource",
982 "uid": "pgwatch-metrics"
983 },
984 "fieldConfig": {
985 "defaults": {
986 "color": {
987 "mode": "palette-classic"
988 },
989 "custom": {
990 "axisBorderShow": false,
991 "axisCenteredZero": false,
992 "axisColorMode": "text",
993 "axisLabel": "",
994 "axisPlacement": "auto",
995 "barAlignment": 0,
996 "drawStyle": "line",
997 "fillOpacity": 10,
998 "gradientMode": "none",
999 "hideFrom": {
1000 "legend": false,
1001 "tooltip": false,
1002 "viz": false
1003 },
1004 "insertNulls": false,
1005 "lineInterpolation": "linear",
1006 "lineWidth": 1,
1007 "pointSize": 5,
1008 "scaleDistribution": {
1009 "type": "linear"
1010 },
1011 "showPoints": "never",
1012 "spanNulls": false,
1013 "stacking": {
1014 "group": "A",
1015 "mode": "none"
1016 },
1017 "thresholdsStyle": {
1018 "mode": "off"
1019 }
1020 },
1021 "mappings": [],
1022 "min": 0,
1023 "thresholds": {
1024 "mode": "absolute",
1025 "steps": [
1026 {
1027 "color": "green",
1028 "value": null
1029 },
1030 {
1031 "color": "red",
1032 "value": 80
1033 }
1034 ]
1035 },
1036 "unit": "percent"
1037 },
1038 "overrides": []
1039 },
1040 "gridPos": {
1041 "h": 5,
1042 "w": 24,
1043 "x": 0,
1044 "y": 30
1045 },
1046 "id": 8,
1047 "interval": "5m",
1048 "options": {
1049 "legend": {
1050 "calcs": [
1051 "mean"
1052 ],
1053 "displayMode": "list",
1054 "placement": "bottom",
1055 "showLegend": true
1056 },
1057 "tooltip": {
1058 "mode": "multi",
1059 "sort": "none"
1060 }
1061 },
1062 "pluginVersion": "10.4.1",
1063 "targets": [
1064 {
1065 "alias": "io_time_pct",
1066 "datasource": {
1067 "type": "grafana-postgresql-datasource",
1068 "uid": "pgwatch-metrics"
1069 },
1070 "format": "time_series",
1071 "group": [],
1072 "groupBy": [
1073 {
1074 "params": [
1075 "$__interval"
1076 ],
1077 "type": "time"
1078 },
1079 {
1080 "params": [
1081 "null"
1082 ],
1083 "type": "fill"
1084 }
1085 ],
1086 "metricColumn": "none",
1087 "orderByTime": "ASC",
1088 "policy": "default",
1089 "query": "SELECT ((non_negative_derivative(mean(\"blk_read_time\")) + non_negative_derivative(mean(\"blk_write_time\"))) / non_negative_derivative(mean(\"total_time\"))) * 100 FROM \"stat_statements\" WHERE \"queryid\" =~ /^$queryid$/ AND $timeFilter GROUP BY time($__interval), \"queryid\" fill(null)",
1090 "rawQuery": true,
1091 "rawSql": "select\n $__timeGroup(time, $agg_interval),\n avg(case when tt = tt_lag then null else (read-read_lag+write-write_lag)::numeric*100 / (tt-tt_lag) end) as \"io_time_pct\"\nfrom (\n select \n (data->'blk_read_time')::int8 as read, lag((data->'blk_read_time')::int8) over w as read_lag,\n (data->'blk_write_time')::int8 as write, lag((data->'blk_write_time')::int8) over w as write_lag,\n (data->'total_time')::int8 as tt, lag((data->'total_time')::int8) over w as tt_lag,\n time\n from stat_statements\n where dbname = '$dbname' and $__timeFilter(time) and tag_data @> '{\"queryid\": \"$queryid\"}'\n window w as (order by time)\n) x\nwhere read >= read_lag and write>= write_lag\ngroup by 1\norder by 1",
1092 "refId": "A",
1093 "resultFormat": "time_series",
1094 "select": [
1095 [
1096 {
1097 "params": [
1098 "value"
1099 ],
1100 "type": "field"
1101 },
1102 {
1103 "params": [],
1104 "type": "mean"
1105 }
1106 ]
1107 ],
1108 "tags": [],
1109 "timeColumn": "time",
1110 "where": [
1111 {
1112 "name": "$__timeFilter",
1113 "params": [],
1114 "type": "macro"
1115 }
1116 ]
1117 }
1118 ],
1119 "title": "% of total_time spent in direct IO ($agg_interval avg.)",
1120 "type": "timeseries"
1121 },
1122 {
1123 "datasource": {
1124 "type": "grafana-postgresql-datasource",
1125 "uid": "pgwatch-metrics"
1126 },
1127 "fieldConfig": {
1128 "defaults": {
1129 "color": {
1130 "mode": "thresholds"
1131 },
1132 "custom": {
1133 "align": "auto",
1134 "cellOptions": {
1135 "type": "auto"
1136 },
1137 "inspect": false
1138 },
1139 "mappings": [],
1140 "thresholds": {
1141 "mode": "absolute",
1142 "steps": [
1143 {
1144 "color": "green",
1145 "value": null
1146 },
1147 {
1148 "color": "red",
1149 "value": 80
1150 }
1151 ]
1152 }
1153 },
1154 "overrides": [
1155 {
1156 "matcher": {
1157 "id": "byName",
1158 "options": "Time"
1159 },
1160 "properties": [
1161 {
1162 "id": "displayName",
1163 "value": "Time"
1164 },
1165 {
1166 "id": "custom.align"
1167 }
1168 ]
1169 },
1170 {
1171 "matcher": {
1172 "id": "byName",
1173 "options": "Metric"
1174 },
1175 "properties": [
1176 {
1177 "id": "unit",
1178 "value": "short"
1179 },
1180 {
1181 "id": "decimals",
1182 "value": 2
1183 },
1184 {
1185 "id": "custom.align"
1186 }
1187 ]
1188 },
1189 {
1190 "matcher": {
1191 "id": "byName",
1192 "options": "Value"
1193 },
1194 "properties": [
1195 {
1196 "id": "unit",
1197 "value": "short"
1198 },
1199 {
1200 "id": "decimals",
1201 "value": 2
1202 },
1203 {
1204 "id": "custom.align"
1205 }
1206 ]
1207 }
1208 ]
1209 },
1210 "gridPos": {
1211 "h": 5,
1212 "w": 24,
1213 "x": 0,
1214 "y": 35
1215 },
1216 "id": 9,
1217 "options": {
1218 "cellHeight": "sm",
1219 "footer": {
1220 "countRows": false,
1221 "fields": "",
1222 "reducer": [
1223 "sum"
1224 ],
1225 "show": false
1226 },
1227 "showHeader": true
1228 },
1229 "pluginVersion": "10.4.1",
1230 "targets": [
1231 {
1232 "datasource": {
1233 "type": "grafana-postgresql-datasource",
1234 "uid": "pgwatch-metrics"
1235 },
1236 "format": "table",
1237 "group": [],
1238 "groupBy": [
1239 {
1240 "params": [
1241 "$__interval"
1242 ],
1243 "type": "time"
1244 },
1245 {
1246 "params": [
1247 "null"
1248 ],
1249 "type": "fill"
1250 }
1251 ],
1252 "metricColumn": "none",
1253 "orderByTime": "ASC",
1254 "policy": "default",
1255 "rawQuery": true,
1256 "rawSql": "select\n tag_data->>'query' as \"Value\"\nfrom stat_statements\nwhere dbname = '$dbname' and tag_data @> '{\"queryid\": \"$queryid\"}'\norder by time desc\nlimit 1",
1257 "refId": "A",
1258 "resultFormat": "time_series",
1259 "select": [
1260 [
1261 {
1262 "params": [
1263 "value"
1264 ],
1265 "type": "field"
1266 },
1267 {
1268 "params": [],
1269 "type": "mean"
1270 }
1271 ]
1272 ],
1273 "tags": [],
1274 "timeColumn": "time",
1275 "where": [
1276 {
1277 "name": "$__timeFilter",
1278 "params": [],
1279 "type": "macro"
1280 }
1281 ]
1282 }
1283 ],
1284 "title": "SQL",
1285 "transformations": [
1286 {
1287 "id": "merge",
1288 "options": {
1289 "reducers": []
1290 }
1291 }
1292 ],
1293 "type": "table"
1294 },
1295 {
1296 "datasource": {
1297 "type": "grafana-postgresql-datasource",
1298 "uid": "pgwatch-metrics"
1299 },
1300 "gridPos": {
1301 "h": 7,
1302 "w": 24,
1303 "x": 0,
1304 "y": 40
1305 },
1306 "id": 7,
1307 "options": {
1308 "code": {
1309 "language": "plaintext",
1310 "showLineNumbers": false,
1311 "showMiniMap": false
1312 },
1313 "content": "<h2>Brought to you by</h2><div style=\"padding: 25px;\"><a href=\"https://www.cybertec-postgresql.com/en/\"><img src=\"https://www.cybertec-postgresql.com/wp-content/uploads/2025/02/cybertec-logo-white-blue.svg\" alt=\"Cybertec – The PostgreSQL Database Company\"></a></div>",
1314 "mode": "html"
1315 },
1316 "pluginVersion": "10.4.1",
1317 "targets": [
1318 {
1319 "datasource": {
1320 "type": "grafana-postgresql-datasource",
1321 "uid": "pgwatch-metrics"
1322 },
1323 "refId": "A"
1324 }
1325 ],
1326 "transparent": true,
1327 "type": "text"
1328 }
1329 ],
1330 "refresh": false,
1331 "schemaVersion": 39,
1332 "tags": [
1333 "pgwatch"
1334 ],
1335 "templating": {
1336 "list": [
1337 {
1338 "current": {
1339 "selected": false,
1340 "text": "test",
1341 "value": "test"
1342 },
1343 "datasource": {
1344 "type": "grafana-postgresql-datasource",
1345 "uid": "pgwatch-metrics"
1346 },
1347 "definition": "",
1348 "hide": 0,
1349 "includeAll": false,
1350 "multi": false,
1351 "name": "dbname",
1352 "options": [],
1353 "query": "SELECT DISTINCT dbname FROM admin.all_distinct_dbname_metrics WHERE metric = 'stat_statements' ORDER BY 1;",
1354 "refresh": 1,
1355 "regex": "",
1356 "skipUrlSync": false,
1357 "sort": 0,
1358 "tagValuesQuery": "",
1359 "tagsQuery": "",
1360 "type": "query",
1361 "useTags": false
1362 },
1363 {
1364 "current": {
1365 "isNone": true,
1366 "selected": false,
1367 "text": "None",
1368 "value": ""
1369 },
1370 "datasource": {
1371 "type": "grafana-postgresql-datasource",
1372 "uid": "pgwatch-metrics"
1373 },
1374 "definition": "select distinct tag_data->>'queryid' from stat_statements WHERE time > current_date -3 and dbname = '$dbname' order by 1;",
1375 "hide": 0,
1376 "includeAll": false,
1377 "multi": false,
1378 "name": "queryid",
1379 "options": [],
1380 "query": "select distinct tag_data->>'queryid' from stat_statements WHERE time > current_date -3 and dbname = '$dbname' order by 1;",
1381 "refresh": 1,
1382 "regex": "",
1383 "skipUrlSync": false,
1384 "sort": 0,
1385 "tagValuesQuery": "",
1386 "tagsQuery": "",
1387 "type": "query",
1388 "useTags": false
1389 },
1390 {
1391 "auto": false,
1392 "auto_count": 30,
1393 "auto_min": "10s",
1394 "current": {
1395 "selected": false,
1396 "text": "30m",
1397 "value": "30m"
1398 },
1399 "hide": 0,
1400 "name": "agg_interval",
1401 "options": [
1402 {
1403 "selected": false,
1404 "text": "1m",
1405 "value": "1m"
1406 },
1407 {
1408 "selected": false,
1409 "text": "5m",
1410 "value": "5m"
1411 },
1412 {
1413 "selected": false,
1414 "text": "10m",
1415 "value": "10m"
1416 },
1417 {
1418 "selected": false,
1419 "text": "15m",
1420 "value": "15m"
1421 },
1422 {
1423 "selected": true,
1424 "text": "30m",
1425 "value": "30m"
1426 },
1427 {
1428 "selected": false,
1429 "text": "1h",
1430 "value": "1h"
1431 },
1432 {
1433 "selected": false,
1434 "text": "6h",
1435 "value": "6h"
1436 },
1437 {
1438 "selected": false,
1439 "text": "12h",
1440 "value": "12h"
1441 },
1442 {
1443 "selected": false,
1444 "text": "1d",
1445 "value": "1d"
1446 }
1447 ],
1448 "query": "1m,5m,10m,15m,30m,1h,6h,12h,1d",
1449 "refresh": 2,
1450 "skipUrlSync": false,
1451 "type": "interval"
1452 }
1453 ]
1454 },
1455 "time": {
1456 "from": "now-12h",
1457 "to": "now"
1458 },
1459 "timepicker": {
1460 "refresh_intervals": [
1461 "5s",
1462 "10s",
1463 "30s",
1464 "1m",
1465 "5m",
1466 "15m",
1467 "30m",
1468 "1h",
1469 "2h",
1470 "1d"
1471 ],
1472 "time_options": [
1473 "5m",
1474 "15m",
1475 "1h",
1476 "6h",
1477 "12h",
1478 "24h",
1479 "2d",
1480 "7d",
1481 "30d"
1482 ]
1483 },
1484 "timezone": "browser",
1485 "title": "Single query details",
1486 "uid": "single-query-details",
1487 "version": 1,
1488 "weekStart": ""
1489}