Обсуждение: ctrl-c - is it safe to kill a query?

Поиск
Список
Период
Сортировка

ctrl-c - is it safe to kill a query?

От
"Mark Steben"
Дата:

Hi folks,

 

We are running psql 8.3.7 and linux 2.6.9-78.0.17.ELsmp

 

We had a situation this weekend where someone was running an update

On the psql command line and had to kill it. 

 

It is considered ‘best practice’ to use cntrl-c to do so?

 Or is there a better way?  The transaction did roll back.

 

Good to know for future reference.  Thank you.

 

 

Mark Steben | Database Administrator 
@utoRevenue® - "Keeping Customers Close" 
95D Ashley Ave, West Springfield, MA 01089
413.243.4800 x1512 (Phone) |413.732-1824 (Fax)

 

Re: ctrl-c - is it safe to kill a query?

От
Bruce Momjian
Дата:
Mark Steben wrote:
> Hi folks,
>
>
>
> We are running psql 8.3.7 and linux 2.6.9-78.0.17.ELsmp
>
>
>
> We had a situation this weekend where someone was running an update
>
> On the psql command line and had to kill it.
>
>
>
> It is considered 'best practice' to use cntrl-c to do so?
>
>  Or is there a better way?  The transaction did roll back.

Sure, that is fine.  It doesn't hurt anything.  There is also a way to
do it from another session using using pg_cancel_backend().

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +