Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 6EE0DEDF370 for ; Tue, 22 May 2012 18:08:46 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SWwJx-0005B9-Kc for pgsql-bugs@postgresql.org; Tue, 22 May 2012 21:08:46 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q4ML8WkH008559; Tue, 22 May 2012 17:08:32 -0400 (EDT) To: Merlin Moncure cc: pgsql-bugs Subject: Re: sequential scans that pick up only deleted records do not honor query cancel or timeout In-reply-to: References: Comments: In-reply-to Merlin Moncure message dated "Tue, 22 May 2012 12:14:04 -0500" Date: Tue, 22 May 2012 17:08:32 -0400 Message-ID: <8558.1337720912@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201205/157 X-Sequence-Number: 33128 Merlin Moncure writes: > Basically, $subject says it all. It's pretty easy to reproduce: > delete all the records from a large table and execute any sequentially > scanning query before autocvacuum comes around and cleans the table > up; the query will be uncancellable. This can result in fairly > pathological behavior in i/o constrained systems because the query > will bog itself down writing out hint bits for minutes or hours > without any way to cancel or effective i/o throttling (unlike vacuum). > IMO, this should be backpatched, and is likely fixed by injecting an > interrupts check at a strategic location. But where? I was thinking > in heapgetpage() but here are no checks elsehwere in heapam.c which is > a red flag. heapgetpage() seems like the most reasonable place to me, as there we'll only be making the check once per page not once per tuple. regards, tom lane