Postgresql – Pausing the import of an SQL file in Postgresql

datafileimportpostgresql

I am currently importing a large database (6 – 7 GB's) into my postgresql on Ubuntu. It's taking sometime to do. A problem has come up where I need to physically relocate the laptop the postgresql is installed on and will more than likely need to be done before the import operation finishes.

Is it possible to pause the import of the database?

If not, will putting the laptop into hibernate while I relocate it cause the import to freeze or fail?

Best Answer

I'm assuming based on the post that the PostgreSQL database server and the process restoring the dump are on the same machine. If so:

Is it possible to pause the import of the database?

Not really. You could SIGSTOP the pg_restore or psql process and/or the corresponding postgres backend, but I wouldn't consider that my first-choice option.

If not, will putting the laptop into hibernate while I relocate it cause the import to freeze or fail?

Since it's a loopback TCP connection or a unix socket connection when you're restoring to a local PostgreSQL instance, it doesn't care if the network changes or goes away. So suspend and resume is just fine.

BTW, 9GB is not large. 1TB is large.