Skip to content

Conversation

@0xgouda
Copy link
Collaborator

@0xgouda 0xgouda commented Nov 11, 2025

  • introduce --maintenance-interval flag that accepts a PostgreSQL interval string and controls the interval at which to run maintenance tasks. 0 disables it.
  • modify --retention to accept PostgreSQL interval string instead of time.Duration, and use the zero value as an indicator to disable it as well.

This assumes that migrating --retention from time.Duration to a string validated as a PostgreSQL interval will be backward-compatible.

closes: #994

@0xgouda 0xgouda marked this pull request as draft November 11, 2025 16:03
@0xgouda 0xgouda force-pushed the 994-maintenance-interval branch from a5dc045 to 03c5be3 Compare November 11, 2025 16:31
@coveralls
Copy link

coveralls commented Nov 11, 2025

Pull Request Test Coverage Report for Build 19297656396

Details

  • 73 of 92 (79.35%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.9%) to 73.724%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/sinks/postgres.go 73 92 79.35%
Totals Coverage Status
Change from base Build 19265612290: 1.9%
Covered Lines: 3670
Relevant Lines: 4978

💛 - Coveralls

@0xgouda 0xgouda marked this pull request as ready for review November 11, 2025 17:01
@0xgouda 0xgouda requested a review from pashagolub November 11, 2025 17:01
@pashagolub pashagolub self-assigned this Nov 12, 2025
@pashagolub pashagolub added enhancement New feature or request sinks Where and how to store monitored data labels Nov 12, 2025
Copy link
Collaborator

@pashagolub pashagolub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

@pashagolub pashagolub merged commit 81b1e27 into master Nov 12, 2025
9 checks passed
@pashagolub pashagolub deleted the 994-maintenance-interval branch November 12, 2025 12:50
0xgouda added a commit to ArnaudDecatec/pgwatch that referenced this pull request Nov 12, 2025
…#1018)

* Introduce `--maintenance-interval` flag

- modify `--retention` to accept PostgreSQL interval string.

* Use new flags to control deletion and maintenance tasks.

* Test `MaintainUniqueSources()` and `DeleteOldPartitions()`

* update docs reference page to mention new flag.

* run `DeleteOldPartitions()` with `retentionInterval` not `maintenanceInterval`

* Rename test

* Capitalize `set` in flag description.

* Fix typo in comment

* rename `CmdOpts.Retention` to `RetentionInterval`

* add `PostgresWriter.scheduleJob()` function

---------

Co-authored-by: Pavlo Golub <pavlo.golub@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request sinks Where and how to store monitored data

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize maintainUniqueSources() load on shared sink databases

4 participants