On the host:

  • CentOS Linux 7 (Core);
  • psql (PostgreSQL) 11.16.


  • prod_db, size 4004 MB.

I created a database dump: pg_dump -U postgres -h prod_db > prod_db.dump.
After that, I delete the database and create an empty database.
After that, I import the database: pgsql -U postgres prod_db < prod_db.dump.
At that point, I can get different results. Sometimes the database is imported successfully (40-50 minutes). Sometimes the database is not imported, "gets stuck" (I waited a maximum of 2 days, then interrupted the process).

No errors in logs. No errors in console.
I tried importing with pg_restore: the result is the same.
I tried importing like this sudo -u postgres psql -U postgres prod_db < prod_db.dump: the result is the same.
I tried to run the import from another host: the result is the same.

After a few days, I used the strace. I have two files with strace output: successful_import.log and unsuccessful_import.log.

If someone can help, I will be very grateful!

P.S.: can provide any additional information.


$ sudo -u postgres psql -c "SELECT datname,wait_event_type,wait_event FROM pg_stat_activity where datname = 'prod_db';"
   datname   | wait_event_type | wait_event
   prod_db   |                 |
(1 row)
  • I'm not going to download large binary files from random websites. Can you include the last dozen lines or so of the unsuccessful one in your post in plain text?
    – jjanes
    Nov 19 at 17:07
  • These are text files in archives.
    – Konstantin
    Nov 21 at 14:10


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.