Skip to content
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

Analyze a PostgreSQL database (optimizer statistics) immediately after the upgrade #601

Merged
merged 5 commits into from Mar 21, 2024

Conversation

vitabaks
Copy link
Owner

@vitabaks vitabaks commented Mar 20, 2024

This PR introduces several important changes to the process of upgrading Postgres to the new major version:

  1. Move the execution of the statistics task to directly follow the PostgreSQL upgrade process, specifically after the pg_upgrade execution but before conducting post-upgrade checks and updating extensions.
    • By shifting the statistics collection earlier, we aim to minimize post-upgrade performance dips and maintain system efficiency. This move aligns with best practices for database management and upgrades.
  2. Move "Wait for the analyze to complete" and "Stop pg_terminator script" to Post-Upgrade tasks.
    • This will allow you to continue performing the remaining tasks of the POST-UPGRADE stage instead of waiting for the statistics collection to be completed. Now we check the status of statistics collection after completing all tasks related to the update.
  3. Monitor and terminate the long-running transactions during statistics collection
    • This task is designed to terminate active queries exceeding a specified duration (in seconds) during the collection of statistics, as defined by the 'vacuumdb_analyze_terminate_threshold' variable. If this variable is set to a value greater than 0 (default is '0'), the pg_terminator script automatically cancels transactions exceeding this duration.
    • This preventative measure helps avoid partial performance degradation of the database during the period when statistics are yet to be fully collected. It ensures the database server resources are not overwhelmed and the number of available connections is not saturated, maintaining efficient database operation

@vitabaks vitabaks self-assigned this Mar 20, 2024
@vitabaks vitabaks merged commit 7135842 into master Mar 21, 2024
17 checks passed
@vitabaks vitabaks deleted the pg-upgrade-analyze branch March 21, 2024 11:56
christofalpo pushed a commit to christofalpo/postgresql_cluster that referenced this pull request Apr 22, 2024
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.

None yet

1 participant