Preventing or controlling runaway queries

From: Eric E <whalesuit(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Preventing or controlling runaway queries
Date: 2005-12-05 19:02:27
Message-ID: 43948EC3.4030407@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Maxwell 2005-12-05 19:07:27 Re: Reduce NUMERIC size by 2 bytes, reduce max length to 508 digits
Previous Message Tom Lane 2005-12-05 18:44:41 Re: troubleshooting hung postmasters

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Burke 2005-12-05 19:06:58 Database with "override" tables
Previous Message Erik Sigra 2005-12-05 18:22:22 Database query: Notification about change?