X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AB7109DCCE1 for ; Mon, 5 Dec 2005 15:02:36 -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 12975-04 for ; Mon, 5 Dec 2005 15:02:36 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by postgresql.org (Postfix) with ESMTP id EC7C89DCAAC for ; Mon, 5 Dec 2005 15:02:33 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i20so711042wra for ; Mon, 05 Dec 2005 11:02:34 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:content-type:content-transfer-encoding; b=cC4FK0P4l/aU1Of4fPMfVAbfq5wObotCQP1UeMJjoUI5LyyMqkCK550GRTqTjZ1wnyXcTEZbaDV9DSTIqHSIoHWlXaIE/nQNnAAsIlFrf3riUlWCvMPAiWOlqpNGayoy8O4/8biuqaJa03NMj1BYX9FRGGlbnuU5haqUENhkqsY= Received: by 10.54.114.14 with SMTP id m14mr4545694wrc; Mon, 05 Dec 2005 11:02:33 -0800 (PST) Received: from ?192.168.130.103? ( [69.17.59.217]) by mx.gmail.com with ESMTP id 40sm400746wrl.2005.12.05.11.02.33; Mon, 05 Dec 2005 11:02:33 -0800 (PST) Message-ID: <43948EC3.4030407@gmail.com> Date: Mon, 05 Dec 2005 14:02:27 -0500 From: Eric E User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-general@postgresql.org Subject: Preventing or controlling runaway queries Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/257 X-Sequence-Number: 87820 Hi all, I've recently had a couple worrisome experiences with runaway queries in postgres 7.4 and 8.0, and I'm wondering what I can do to control or prevent these. When I ran a query against a large table, I accidentally omitted mistyped a table name, and a table was automatically added, resulting in a massive result set that crash my postmaster instance. I know that the automatic addition of missing tables to queries can be disabled, so I'm not so worried about that. However, I am worried about generic queries being able to crash the entire server instance, which in my case occurs because the query process keeps allocating more memory until the machine is out of memory, then Linux' memory manager kills the process (I learned this latter part thanks to the list archives). Is there some way to limit the amount of memory a single query process can use? If it reaches that limit, what happens to the query? What I'm looking for is a way to have the query be ended or suspended without the OS (Linux) killing the server process). Does anyone had suggestions on how to accomplish this? Thanks, Eric