Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit 102860c

Browse files
authored
Merge pull request #66 from ContaAzul/approx
Use pgstattuple_approx
2 parents 4c8e831 + 583ad10 commit 102860c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gauges/deadtuples.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (g *Gauges) DeadTuples() *prometheus.GaugeVec {
4141
for _, table := range tables {
4242
var pct []float64
4343
if err := g.queryWithTimeout(
44-
"SELECT dead_tuple_percent FROM pgstattuple($1)",
44+
"SELECT dead_tuple_percent FROM pgstattuple_approx($1)",
4545
&pct,
4646
[]interface{}{table.Name},
4747
1*time.Minute,
@@ -57,8 +57,8 @@ func (g *Gauges) DeadTuples() *prometheus.GaugeVec {
5757
}
5858

5959
func (g *Gauges) hasPermissionToExecutePgStatTuple() bool {
60-
if _, err := g.db.Exec("SELECT 1 FROM pgstattuple('pg_class')"); err != nil {
61-
log.WithField("db", g.name).WithError(err).Error("failed to execute pgstattuple function")
60+
if _, err := g.db.Exec("SELECT 1 FROM pgstattuple_approx('pg_class')"); err != nil {
61+
log.WithField("db", g.name).WithError(err).Error("failed to execute pgstattuple_approx function")
6262
return false
6363
}
6464
return true

0 commit comments

Comments
 (0)