python - Restore postrgres without ending connections -


i run number of queries adhoc analysis against postgres database. many times leave connection open through day instead of ending after each query.

i receive postgres dump on scp through shell script every 5 minutes , restore database without cutting connections. possible?

one of few activities cannot perform while user connected dropping database.
– if doing during restore – you'll have change approach. don't drop database (don't use -c option in pg_dump or pg_restore), rather drop , recreate schemas , objects don't depend on schema (like large objects).
can use -c flag of pg_dump or pg_restore that.

the other problem might run connections open transactions (state “idle in transaction”). such connections can hold locks keep dropping , recreating objects, , you'll have use pg_terminate_backend() rid of them.


Comments