-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchanges.sql
More file actions
38 lines (35 loc) · 1009 Bytes
/
changes.sql
File metadata and controls
38 lines (35 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Before (Deprecated singlestat):
{
"type": "singlestat",
"title": "Avg Query Time (ms)",
"format": "ms",
"thresholds": "10,50"
}
// After (Modern stat):
{
"type": "stat",
"title": "Avg Query Time (ms)",
"fieldConfig": {
"defaults": {
"unit": "ms",
"decimals": 2,
"thresholds": {
"mode": "absolute",
"steps": [
{ "color": "green", "value": null },
{ "color": "orange", "value": 50 },
{ "color": "red", "value": 100 }
]
}
}
},
"options": {
"textMode": "value_and_name",
"colorMode": "background"
}
}
SELECT DISTINCT tag_data->>'queryid'
FROM stat_statements WHERE time > current_date - 3 AND dbname = '$dbname' ORDER BY 1;
SELECT DISTINCT (tag_data->>'queryid') || ' - ' || LEFT(tag_data->>'query', 60) AS __text,
tag_data->>'queryid' AS __value FROM stat_statements WHERE time > current_date - 3
AND dbname = '$dbname' ORDER BY 1;