You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"rawSql": "SELECT\n total_time, mean_time, calls as total_calls, seconds_since_last_exec, queryid, query\nFROM (\n\nSELECT\n DISTINCT ON (queryid) queryid, time, total_time, mean_time, calls, query\nFROM (\n\nSELECT\n time, (data->>'total_time')::float as total_time, (data->>'total_time')::float / (data->>'calls')::int8 as mean_time, (data->>'calls')::int8 as calls, tag_data->>'queryid' as queryid, tag_data->>'query' as query\nFROM stat_statements\nWHERE\n dbname = '$dbname'\n AND time > now() - '$calls_interval'::interval\n AND tag_data->>'query' ~* '$sql_fragment'\n AND CASE WHEN length('$sql_fragment') > 2 THEN true ELSE false END\n) x\nORDER BY queryid, time DESC, mean_time, calls, query\n\n) y\nJOIN LATERAL \n (select (extract(epoch from now() - prev.time))::int8 as seconds_since_last_exec\n from stat_statements prev\n where dbname = '$dbname' and time > now() - '$calls_interval'::interval\n and prev.time < y.time and (prev.data->>'calls')::int8 != y.calls\n order by time desc limit 1\n) z on true\n\nORDER BY total_time DESC LIMIT 100",
168
+
"refId": "A",
169
+
"select": [
170
+
[
171
+
{
172
+
"params": [
173
+
"value"
174
+
],
175
+
"type": "column"
176
+
}
177
+
]
178
+
],
179
+
"timeColumn": "time",
180
+
"where": [
181
+
{
182
+
"name": "$__timeFilter",
183
+
"params": [],
184
+
"type": "macro"
185
+
}
186
+
]
187
+
}
188
+
],
189
+
"title": "Matching Queries",
190
+
"transformations": [
191
+
{
192
+
"id": "merge",
193
+
"options": {
194
+
"reducers": []
195
+
}
196
+
}
197
+
],
198
+
"type": "table"
199
+
},
200
+
{
201
+
"fieldConfig": {
202
+
"defaults": {},
203
+
"overrides": []
204
+
},
205
+
"gridPos": {
206
+
"h": 5,
207
+
"w": 24,
208
+
"x": 0,
209
+
"y": 16
210
+
},
211
+
"id": 4,
212
+
"options": {
213
+
"code": {
214
+
"language": "plaintext",
215
+
"showLineNumbers": false,
216
+
"showMiniMap": false
217
+
},
218
+
"content": "### Brought to you by\n\n[](https://www.cybertec-postgresql.com/en/)\n",
219
+
"mode": "markdown"
220
+
},
221
+
"pluginVersion": "12.0.0",
222
+
"title": "",
223
+
"transparent": true,
224
+
"type": "text"
225
+
}
226
+
],
227
+
"preload": false,
228
+
"refresh": "",
229
+
"schemaVersion": 41,
230
+
"tags": [
231
+
"pgwatch"
232
+
],
233
+
"templating": {
234
+
"list": [
235
+
{
236
+
"datasource": {
237
+
"type": "grafana-postgresql-datasource",
238
+
"uid": "pgwatch-metrics"
239
+
},
240
+
"definition": "SELECT DISTINCT dbname FROM admin.all_distinct_dbname_metrics WHERE metric = 'stat_statements' ORDER BY 1;",
241
+
"includeAll": false,
242
+
"name": "dbname",
243
+
"options": [],
244
+
"query": "SELECT DISTINCT dbname FROM admin.all_distinct_dbname_metrics WHERE metric = 'stat_statements' ORDER BY 1;",
245
+
"refresh": 1,
246
+
"regex": "",
247
+
"type": "query"
248
+
},
249
+
{
250
+
"current": {
251
+
"text": "",
252
+
"value": ""
253
+
},
254
+
"label": "SQL search fragment (case insensitive, 3 char min.)",
0 commit comments