Skip to content

Commit a8e4062

Browse files
committed
Optimize pg_stat_statements collection
1 parent ec0d629 commit a8e4062

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

collector/collect.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,10 @@ func (c *collector) collectCluster(o CollectConfig) {
352352
}
353353

354354
c.getLocks()
355+
356+
if !arrayHas(o.Omit, "statements") {
357+
c.getStatements()
358+
}
355359
}
356360

357361
// info and stats for the current database
@@ -381,9 +385,6 @@ func (c *collector) collectDatabase(o CollectConfig) {
381385
if !arrayHas(o.Omit, "tables") && !arrayHas(o.Omit, "triggers") {
382386
c.getDisabledTriggers()
383387
}
384-
if !arrayHas(o.Omit, "statements") {
385-
c.getStatements()
386-
}
387388
c.getBloat()
388389

389390
// logical replication, added schema v1.2

0 commit comments

Comments
 (0)