can't cancel a query with pg_cancel_backend

From: Marc Cousin <mcousin(at)sigma(dot)fr>
To: pgsql-admin(at)postgresql(dot)org
Subject: can't cancel a query with pg_cancel_backend
Date: 2009-05-05 13:36:52
Message-ID: 200905051536.52251.mcousin@sigma.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi, I'm having a problem cancelling a query.

I've already had sometimes this kind of problem, but not this hard (and I
didn't find anything searching the archives, but still I remember seeing
discussions about this). Usually, it cancels in a few seconds to a minute.

I've run this query an hour ago (very simple one, on a bacula database) :

SELECT * from file where pathid = 120;

The database is quite big, file is nearly one billion records.
There is no index with first column on pathid.

Here is the table:

bacula=# \d file
Table "public.file"
Column | Type | Modifiers
------------+---------+-------------------------------------------------------
fileid | bigint | not null default nextval('file_fileid_seq'::regclass)
fileindex | integer | not null default 0
jobid | integer | not null
pathid | integer | not null
filenameid | integer | not null
markid | integer | not null default 0
lstat | text | not null
md5 | text | not null
Indexes:
"file_pkey" UNIQUE, btree (fileid)
"file_fp_idx" btree (filenameid, pathid)
"file_jpfid_idx" btree (jobid, pathid, filenameid)

This is the query plan (so it goes with the third index):

--------------------------------------------------------------------------------------
Index Scan using file_jpfid_idx on file (cost=0.00..7327212.07 rows=2128
width=104)
Index Cond: (pathid = 120)
(2 rows)

When I remembered I didn't have a good index, I tried to cancel the query, but
I can't ( I tried with Ctrl+C from my psql client, then with
pg_cancel_backend in another session, then with sigterm, I know this one
isn't supported, but it didn't solve the problem either...)

Is this an expected behavior ?

Database is 8.3.5 on debian lenny.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2009-05-05 14:35:11 Re: can't cancel a query with pg_cancel_backend
Previous Message Joshua D. Drake 2009-05-04 21:57:27 Re: standby shutdown