终止和取消过程之间的区别 [英] Difference between terminating and cancelling a process
问题描述
函数pg_cancel_backend(pid int)和pg_terminate_backend(pid int)有什么区别?对我来说,它们的工作原理几乎相同.
What's the difference between functions: pg_cancel_backend(pid int) and pg_terminate_backend(pid int)? For me they work pretty the same.
推荐答案
pg_cancel_backend()取消正在运行的查询,而pg_terminate_backend()则终止整个过程,从而终止了数据库连接.
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.
这篇关于终止和取消过程之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!