-
Notifications
You must be signed in to change notification settings - Fork 16
Add 3 new queries + update vacuum_stats view with manual_vacuum_count and autovacuum_count
#33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
lib/ruby-pg-extras.rb
Outdated
| 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})" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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

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
87a95e8 to
7a89d54
Compare
- 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
08da779 to
db46d15
Compare
|
@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 I do believe on the diagnose page, there is something we can work on there.
if you have any ideas they're welcome. I'll try to think of something in the meantime |
manual_vacuum_count and autovacuum_count
db46d15 to
a96b38b
Compare
|
I think for now this can be merged, I'll work on fixing the missing_fk_indexes and missing_fk_constraints next weekend 👍🏼 |
|
@chaadow can you update readme with info about the new methods? |
888c9a3 to
45be9e4
Compare
…ts queries + updated vacuum_stats command
45be9e4 to
ed5dc5f
Compare
|
@pawurb done |
|
thanks! |

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
manual_vacuum_countandautovacuum_count