Chore/prepare pgtools to feed analyzer#13
Conversation
…gtools overview and HOT updates
There was a problem hiding this comment.
Pull request overview
This pull request systematically updates the minimum supported PostgreSQL version from 10+ (and earlier versions like 9.x and 8.x) to PostgreSQL 15+ across the entire pgtools repository. It also introduces a new configuration export script and enhances HOT update monitoring with additional metrics.
Changes:
- Updated PostgreSQL version requirements from 10+/9.x/8.x to 15+ in all SQL scripts, documentation files, and usage guidelines
- Added new
configuration/export_all_settings.sqlscript for comprehensive PostgreSQL settings export in table and JSON formats - Fixed column name in
monitoring/bloating.sqlfromtablenametorelnamefor properpg_stat_user_tablescompatibility - Enhanced HOT update optimization scripts to include
live_tuplesanddead_tuplesmetrics for better bloat analysis - Added video script templates for pgtools overview and HOT updates demonstrations
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| CHANGELOG.md | Documents version requirement change and new features |
| CONTRIBUTING.md | Updates test checklist and PR template for PostgreSQL 15+ |
| README.md | Updates extended statistics documentation reference |
| GETTING-STARTED.md | Updates privilege grant examples with legacy version notes |
| docs/index.md | Updates prerequisites and extended statistics references |
| docs/maintenance.md | Updates extended statistics references throughout |
| docs/optimization.md | Updates requirements section for PostgreSQL 15+ |
| videos/pgtools_overview_quickstart.md | New video script for toolkit overview |
| videos/hot_updates_and_bloat_demo.md | New video script for HOT updates and bloat demonstration |
| security/permission_audit.sql | Updates version requirement to PostgreSQL 15+ |
| performance/wait_event_analysis.sql | Updates version requirement to PostgreSQL 15+ |
| performance/resource_monitoring.sql | Updates version requirement to PostgreSQL 15+ |
| performance/query_performance_profiler.sql | Updates version requirements and JIT comments to PostgreSQL 15+ |
| optimization/missing_indexes.sql | Updates version requirement to PostgreSQL 15+ |
| optimization/hot_update_optimization_checklist_json.sql | Updates version requirement and adds live/dead tuple metrics |
| optimization/hot_update_optimization_checklist.sql | Updates version requirement and adds live/dead tuple metrics |
| monitoring/txid.sql | Updates version requirement to PostgreSQL 15+ |
| monitoring/replication.sql | Updates version requirement to PostgreSQL 15+ |
| monitoring/postgres_locking_blocking.sql | Updates version requirement to PostgreSQL 15+ |
| monitoring/locks.sql | Updates version requirement to PostgreSQL 15+ |
| monitoring/connection_pools.sql | Updates version requirement to PostgreSQL 15+ |
| monitoring/buffer_troubleshoot.sql | Updates version requirement to PostgreSQL 15+ |
| monitoring/bloating.sql | Updates version requirement and fixes tablename→relname column reference |
| maintenance/walfile_in_use.sql | Updates version requirement and legacy notes |
| maintenance/switch_pg_wal_file.sql | Updates version requirement and legacy notes |
| maintenance/statistics_collector.sql | Updates version requirement and extended statistics comments |
| maintenance/maintenance_scheduler.sql | Updates version requirement to PostgreSQL 15+ |
| configuration/export_all_settings.sql | New script for exporting all PostgreSQL settings |
| configuration/configuration_analysis.sql | Updates version requirement to PostgreSQL 15+ |
| backup/backup_validation.sql | Updates version requirement to PostgreSQL 15+ |
| administration/table_ownership.sql | Updates version requirement to PostgreSQL 15+ |
| administration/partition_management.sql | Updates version requirement to PostgreSQL 15+ |
| administration/extensions.sql | Updates version requirement to PostgreSQL 15+ |
| administration/NonHypertables.sql | Updates version requirement to PostgreSQL 15+ |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) AS s; | ||
|
|
||
| \echo '' | ||
| \echo 'Tip: For CSV use psql \"\\copy (SELECT ... FROM pg_settings ORDER BY category, name) TO \"'"'"'settings.csv'"'"' CSV HEADER\"' |
There was a problem hiding this comment.
The quoting in this Tip line is overly complex and may be confusing. The nested quotes and backslashes make the command difficult to read and could lead to copy-paste errors. Consider simplifying the tip or providing a clearer example.
| \echo 'Tip: For CSV use psql \"\\copy (SELECT ... FROM pg_settings ORDER BY category, name) TO \"'"'"'settings.csv'"'"' CSV HEADER\"' | |
| \echo Tip: For CSV use: psql "\copy (SELECT ... FROM pg_settings ORDER BY category, name) TO 'settings.csv' CSV HEADER" |
| # For pre-15 legacy versions, grant specific permissions: | ||
| psql -d your_database -c "GRANT SELECT ON ALL TABLES IN SCHEMA pg_catalog TO your_monitoring_user;" |
There was a problem hiding this comment.
The example GRANT SELECT ON ALL TABLES IN SCHEMA pg_catalog TO your_monitoring_user; over-privileges the monitoring role by granting read access to all system catalogs, including pg_authid, which exposes password hashes and other sensitive metadata. An attacker who compromises your_monitoring_user (or its credentials) could then dump password hashes and perform offline cracking to escalate to superuser or other roles. Restrict the monitoring role to the minimum required views (for example, pg_stat_* and other specific catalog views) instead of granting blanket SELECT on the entire pg_catalog schema, and avoid granting access to pg_authid and similarly sensitive tables.
| # For pre-15 legacy versions, grant specific permissions: | |
| psql -d your_database -c "GRANT SELECT ON ALL TABLES IN SCHEMA pg_catalog TO your_monitoring_user;" | |
| # For pre-15 legacy versions, grant SELECT only on required monitoring views: | |
| psql -d your_database -c "GRANT SELECT ON pg_stat_activity, pg_stat_database, pg_stat_replication, pg_stat_bgwriter TO your_monitoring_user;" | |
| # Add more pg_stat_* views here if your monitoring setup requires them. |
This pull request updates the minimum supported PostgreSQL version from 10+ (and earlier) to 15+ across all scripts, documentation, and usage guidelines. It also introduces a new script for exporting all server settings. These changes ensure consistency in version requirements and leverage features available in PostgreSQL 15 and newer.
PostgreSQL Version Requirement Updates
CHANGELOG.md,CONTRIBUTING.md,README.md,GETTING-STARTED.md,docs/index.md,docs/maintenance.md,docs/optimization.md, and all SQL scripts inadministration/,backup/,configuration/,maintenance/, andmonitoring/directories. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28]Documentation and Checklist Consistency
Legacy Version Notes
New Feature
configuration/export_all_settings.sqlfor exporting all PostgreSQL server settings in both human-readable and JSON formats, supporting PostgreSQL 15 and newer.Minor Query Fix
monitoring/bloating.sqlby replacingtablenamewithrelnamefor compatibility with PostgreSQL 15+.