Received: from l2.socialecology.com (unknown [4.42.179.131]) by postgresql.org (Postfix) with ESMTP id 89D6547511A for ; Fri, 12 Jul 2002 13:22:14 -0400 (EDT) Received: from 4.42.179.151 (broccoli.socialecology.com [4.42.179.151]) by l2.socialecology.com (Postfix) with SMTP id 939EE127983 for ; Fri, 12 Jul 2002 10:22:13 -0700 (PDT) X-Mailer: UserLand Frontier 8.0.5 (Macintosh OS) (mailServer v1.1..141) Mime-Version: 1.0 Message-Id: <57020238.1185653165@[4.42.179.151]> X-authenticated-sender: erics In-reply-to: <200207120501.g6C51Vo14062@candle.pha.pa.us> Date: Fri, 12 Jul 2002 10:22:11 -0700 To: pgsql-sql@postgresql.org From: eric soroos Subject: Re: Query kill Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200207/194 X-Sequence-Number: 8573 On Fri, 12 Jul 2002 01:01:31 -0400 (EDT) in message <200207120501.g6C51Vo14062@candle.pha.pa.us>, Bruce Momjian wrote: > Rudi Starcevic wrote: > > Hello, > > > > If I write a query that is inefficient or in an eternal loop how > > do I stop it without restarting the postmaster ? > > > > I can see many postmaster processed appearing in the output of the 'ps' > > command. > > Do I need to stop/kill them all or can I stop just the query I want ? > > Just send a SIGINT to the process. That simulates a ^C, which works too > from the client like psql. Is there a way to deny permission for certain users to execute a query that exceeds some expected cost? For example, I have a query builder from user input that could produce a query that ends up doing something that the query planner thinks will take 8M units of work. Generally, this is an unconstrained join between my biggest tables, a result that is neither fast nor useful. If I could set a threshold of 1M units for the webapp user, I could trap this sort of thing before they cause quality of service issues. eric