Question

What's the difference between functions: pg_cancel_backend(pid int) and pg_terminate_backend(pid int)? For me they work pretty the same.

Was it helpful?

Solution

pg_cancel_backend() cancels the running query while pg_terminate_backend() terminates the entire process and thus the database connection.

When a program creates a database connection and sends queries, you can cancel one query without destroying the connection and stopping the other queries. If you destroy the entire connection, everything will be stopped.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top