diff --git a/pkg/db/index.go b/pkg/db/index.go index ba1963d..8d9b59b 100644 --- a/pkg/db/index.go +++ b/pkg/db/index.go @@ -96,12 +96,12 @@ func (pg *PgConnection) ReindexTable(ctx context.Context, schema, table string, } if initialIndexStats.PageCount < params.MINIMAL_COMPACT_PAGES { - pg.log.Warnf("skipping reindex: %s.%s, too few pages (has %d and the minimum is %d)", schema, index.IndexName, initialIndexStats.PageCount, params.MINIMAL_COMPACT_PAGES) + pg.log.Infof("skipping reindex: %s.%s, too few pages (has %d and the minimum is %d)", schema, index.IndexName, initialIndexStats.PageCount, params.MINIMAL_COMPACT_PAGES) continue } - if indexBloatStats.FreePerctent < params.MINIMAL_COMPACT_PERCENT { - pg.log.Warnf("skipping reindex: %s.%s, %.2f%s free space is below required %.2f%s", schema, index.IndexName, indexBloatStats.FreePerctent, "%", params.MINIMAL_COMPACT_PERCENT, "%") + if indexBloatStats.FreePerctent < params.MINIMAL_COMPACT_PERCENT*100 { + pg.log.Infof("skipping reindex: %s.%s, %.2f%s free space is below required %.2f%s", schema, index.IndexName, indexBloatStats.FreePerctent, "%", params.MINIMAL_COMPACT_PERCENT*100, "%") continue } } diff --git a/pkg/defrag/process.go b/pkg/defrag/process.go index 0c712b0..556edba 100644 --- a/pkg/defrag/process.go +++ b/pkg/defrag/process.go @@ -263,7 +263,7 @@ func (p *Process) process(ctx context.Context, schema, table string, attepmt int isSkipped = true } - if bloatStats.FreePercent < params.MINIMAL_COMPACT_PERCENT { + if bloatStats.FreePercent < params.MINIMAL_COMPACT_PERCENT*100 { p.log.Warnf("Table %s.%s has less than %0.f%% space to compact (actual is %0.3f%%), skipping defragmentation", schema, table, @@ -484,7 +484,7 @@ func (p *Process) process(ctx context.Context, schema, table string, attepmt int p.log.Infof("Bloat statistics with pgstattuple: duration %s", time.Since(getStatsStart)) } - willBeSkipped := !isLocked && (isLocked || tableInfo.Stats.PageCount < params.MINIMAL_COMPACT_PAGES || bloatStats.FreePercent < params.MINIMAL_COMPACT_PERCENT) + willBeSkipped := !isLocked && (isLocked || tableInfo.Stats.PageCount < params.MINIMAL_COMPACT_PAGES || bloatStats.FreePercent < params.MINIMAL_COMPACT_PERCENT*100) if !isLocked && (!p.NoReindex && (!isSkipped || attepmt >= params.MAX_RETRY_COUNT || (!isReindexed && !isSkipped && attepmt == 0))) { if ok, err := p.Pg.ReindexTable(ctx, schema, table, p.Force, p.NoReindex); err != nil {