Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 299BC9FA2E4 for ; Thu, 1 Feb 2007 10:11:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 42503-07 for ; Thu, 1 Feb 2007 10:11:11 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id CF6899F9D4D for ; Thu, 1 Feb 2007 10:11:11 -0400 (AST) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HCceS-0006ap-Mu for pgsql-performance@postgresql.org; Thu, 01 Feb 2007 15:11:00 +0100 Received: from frigga.summersault.com ([12.161.105.138]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 01 Feb 2007 15:11:00 +0100 Received: from mark by frigga.summersault.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 01 Feb 2007 15:11:00 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: Mark Stosberg Subject: Using statement_timeout as a performance tool? Date: Thu, 01 Feb 2007 09:10:09 -0500 Lines: 27 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: frigga.summersault.com User-Agent: Thunderbird 1.5.0.8 (X11/20061109) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/1 X-Sequence-Number: 23055 Hello, I'm working on setting up replication with Slony, and will soon have a slave that a lot of SELECT traffic will be sent to (over 500k/day). The primary query we need to run is somewhat complex, but seems to complete on average in well under a second. However, every so often (less in 1 in 10,000 queries) we'll see the query take 2 or 3 minutes. It's not clear why this is happening-- perhaps there is something else going on that is affecting this query. I'm considering the use of "statement_timeout" to limit the time of this particular query, to suppress the rare "run away", and avoid tying up the processor for that additional time. I think it may be better to give up, quit spending cycles on it right then, and return an "oops, try again in a few minutes" message instead. From the data we have, seems like it has a strong chance of working again. Is anyone else using "statement_timeout" as part of an overall performance plan? Mark