Preventing or controlling runaway queries - Mailing list pgsql-general

From Eric E
Subject Preventing or controlling runaway queries
Date
Msg-id 43948EC3.4030407@gmail.com
Whole thread Raw
Responses Re: Preventing or controlling runaway queries
List pgsql-general
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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: troubleshooting hung postmasters
Next
From: Rory Campbell-Lange
Date:
Subject: Using a 250GB RAID10 server for postgres