X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 018B99DC85F for ; Tue, 7 Feb 2006 18:09:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59542-09 for ; Tue, 7 Feb 2006 18:09:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by postgresql.org (Postfix) with ESMTP id E70659DC80F for ; Tue, 7 Feb 2006 18:09:08 -0400 (AST) Received: from [192.168.0.5] (unknown [84.12.81.110]) by smtp.nildram.co.uk (Postfix) with ESMTP id 561F2255B1C; Tue, 7 Feb 2006 22:08:59 +0000 (GMT) Subject: Re: partitioning and locking problems From: Simon Riggs To: Marc Morin Cc: Markus Schaber , pgsql-performance@postgresql.org In-Reply-To: <2BCEB9A37A4D354AA276774EE13FB8C2BCC2A6@mailserver.sandvine.com> References: <2BCEB9A37A4D354AA276774EE13FB8C2BCC2A6@mailserver.sandvine.com> Content-Type: text/plain Date: Tue, 07 Feb 2006 22:09:02 +0000 Message-Id: <1139350142.1258.174.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.075 required=5 tests=[AWL=0.075] X-Spam-Score: 0.075 X-Spam-Level: X-Archive-Number: 200602/57 X-Sequence-Number: 17043 On Thu, 2006-02-02 at 11:27 -0500, Marc Morin wrote: > > > 1- long running report is running on view > > > 2- continuous inserters into view into a table via a rule > > > 3- truncate or rule change occurs, taking an exclusive lock. > > > Must wait for #1 to finish. > > > 4- new reports and inserters must now wait for #3. > > > 5- now everyone is waiting for a single query in #1. Results > > > in loss of insert data granularity (important for our application). > Using a separate lock table is what we've decided to do in this > particular case to serialize #1 and #3. Inserters don't take this lock > and as such will not be stalled. Would it not be simpler to have the Inserters change from one table to another either upon command, on a fixed timing cycle or even better based upon one of the inserted values (Logdate?) (or all 3?). (Requires changes in the application layer: 3GL or db functions). The truncates can wait until the data has stopped being used. I'd be disinclined to using the locking system as a scheduling tool. Best Regards, Simon Riggs