Skip to content

Conversation

@chaadow
Copy link
Contributor

@chaadow chaadow commented Nov 30, 2025

  • ANALYZE progress:
    • Useful to check to know if PG is acquiring sample rows on a certain table
image
  • VACUUM progress
    • Useful to know when vacuum workers are working or if you suspect the system beingn slow for some reason. This could also help check if there are multiple vacuums happening at the same time
image image
  • Update the vacuum_stats view by adding two new columns: manual_vacuum_count and autovacuum_count
image

if query_name == :vacuum_io_stats
server_version_num = conn.send(exec_method, "SHOW server_version_num").to_a[0].values[0].to_i
if server_version_num < 160000
raise "vacuum_io_stats query requires PostgreSQL 16 or newer (server_version_num=#{server_version_num})"
Copy link
Contributor Author

@chaadow chaadow Nov 30, 2025

Choose a reason for hiding this comment

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

this makes the tests fail. I dont know if I should add an "empty legacy file" that has one SQL comment stating that this feature is not available for versions below 16 ? @pawurb

Copy link
Owner

Choose a reason for hiding this comment

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

yes, please make it no-op on ooder sql versions, sth like select 1 and comment explaining why

Copy link
Contributor Author

@chaadow chaadow Nov 30, 2025

Choose a reason for hiding this comment

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

@pawurb I did something like for a "decent" UX
image

also there is a UI "bug" where self.description_for unfortunately ALWAYS uses the description of the query_name, disregarding any legacy or 17 versions.

That's why for now I've opted onto this special select instead of a select 1

@chaadow chaadow force-pushed the add_more_stats branch 2 times, most recently from 87a95e8 to 7a89d54 Compare November 30, 2025 18:36
@chaadow chaadow requested a review from pawurb November 30, 2025 18:39
- ANALYZE progress
Useful to check to know if PG is acquiring sample rows on a certain
table

- VACUUM progress
Useful to know when vacuum workers are working or if you suspect the
system beingn slow for some reason. This could also help check if there are
multiple vacuums happening at the same time

-  Cumulative I/O statistics with pg_stat_io for vacuum purposes
this can help detect if we're vacuuming too often. This might get added
to the diagnose page in a later PR.
More info: https://pganalyze.com/blog/pg-stat-io#tracking-cumulative-io-activity-by-autovacuum-and-manual-vacuums
@chaadow chaadow force-pushed the add_more_stats branch 2 times, most recently from 08da779 to db46d15 Compare November 30, 2025 19:10
@chaadow
Copy link
Contributor Author

chaadow commented Nov 30, 2025

@pawurb while reading : https://www.postgresql.org/docs/17/monitoring-stats.html#MONITORING-PG-STAT-ALL-TABLES-VIEW

I realized there was 2 intersting columns that were not reported in the vacuum_stats table. which are how many manual vacuum have been run. And more importantly, how many autovacuum have been run
image

I do believe on the diagnose page, there is something we can work on there.

  • maybe report tables that have a lot of autovacuums ( we'll have to think about what determines/defines "a lot" )
  • report if VACUUM is doing a lot of IO by looking at the pg_stat_io

if you have any ideas they're welcome. I'll try to think of something in the meantime

@chaadow chaadow changed the title Add 3 new queries Add 3 new queries + update vacuum_stats view with manual_vacuum_count and autovacuum_count Nov 30, 2025
@chaadow
Copy link
Contributor Author

chaadow commented Nov 30, 2025

I think for now this can be merged, I'll work on fixing the missing_fk_indexes and missing_fk_constraints next weekend 👍🏼

@pawurb
Copy link
Owner

pawurb commented Dec 1, 2025

@chaadow can you update readme with info about the new methods?

@chaadow chaadow force-pushed the add_more_stats branch 2 times, most recently from 888c9a3 to 45be9e4 Compare December 1, 2025 21:27
@chaadow
Copy link
Contributor Author

chaadow commented Dec 1, 2025

@pawurb done

@pawurb pawurb merged commit c8879c0 into pawurb:main Dec 1, 2025
6 checks passed
@pawurb
Copy link
Owner

pawurb commented Dec 1, 2025

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants