PG_Restore longrunning

2025-11-25T12:57:38.1966667+00:00

PG_Restore longrunning morethan 24 hrs on azure postgresql server ( Standard_D4ds_v4 (4 vCores, 16 GiB memory, 6400 max iops) source database size is 2.8 TB .How to improve the pg_restore performance duration pg_dump only taking 8 hrs

Azure Database for PostgreSQL
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2025-11-25T12:57:47.52+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To improve the performance duration of pg_restore on your Azure PostgreSQL server, consider the following best practices:

    1. Use Parallel Restore: Utilize multiple concurrent jobs during the restore process. The number of jobs can be equal to or less than the number of vCPUs allocated for the target server. For example, if you have 4 vCores, you can set the -j option to 4 or fewer.
    2. Optimize Server Parameters: Before running pg_restore, you can optimize certain server parameters:
      • Set work_mem to a higher value (e.g., 32 MB).
      • Increase max_wal_size to 64 GB.
      • Set checkpoint_timeout to 60 minutes.
      • Adjust maintenance_work_mem to 2 GB.
      • Disable autovacuum during the restore process.
      • Enable wal_compression. After the restore, ensure to revert these parameters to their appropriate values based on your workload requirements.
    3. Disable High Availability (HA): If HA is enabled, consider disabling it before running pg_restore to reduce overhead.
    4. Analyze Tables Post-Restore: After the restore is complete, analyze all tables to ensure that statistics are updated, which can improve query performance.
    5. Review Logs for Errors: Always check the errors.log file after the restore process to address any issues that may have occurred during the operation.

    By implementing these strategies, you should be able to reduce the duration of your pg_restore process significantly.


    References:


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.