Re: Difference between terminate/cancel?

From: François Beausoleil <francois(at)teksol(dot)info>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Forums postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Difference between terminate/cancel?
Date: 2013-08-13 17:44:43
Message-ID: 684E2D14-2D66-4202-BD0E-B5FC39025F50@teksol.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Le 2013-08-13 à 13:25, Kevin Grittner a écrit :

> François Beausoleil <francois(at)teksol(dot)info> wrote:
>
>> What is the difference between both?
>
>> I had some processes stuck in IDLE in transaction after a machine
>> died (through pgbouncer), and cancel did not close the
>> connections, while terminate did kill the transactions.
>
>> The docs at
>> http://www.postgresql.org/docs/9.1/static/functions-admin.html#FUNCTIONS-ADMIN-SIGNAL-TABLE
>> [...]
>
> According to the docs you cite:
>
> pg_cancel_backend(): Cancel a backend's current query
> pg_terminate_backend(): Terminate a backend
>
> A connection which is idle or idle in transaction does not have a
> current query to cancel, but it has a backend process which can be
> terminated.

Oh, interesting! Now I understand better. Extracted like that, it's obvious what the difference is.

Thanks!
François

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-08-13 18:03:18 Re: View permission error after upgrading from 8.4 -> 9.2
Previous Message Michael Cronenworth 2013-08-13 17:35:17 MinGW compiled client library