pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marek Pętlicki <marpet@buy.pl>
To: Shaun Thomas <sthomas@townnews.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-admin@postgresql.org
Subject: Re: Cost limit.
Date: Fri, 18 May 2001 21:06:31 +0200
Message-ID: <20010518210631.A4103@marek.almaran.home> (raw)
In-Reply-To: <Pine.LNX.4.30.0105181141320.4466-100000@hamster.lee.net>
References: <19867.990202907@sss.pgh.pa.us>
	<Pine.LNX.4.30.0105181141320.4466-100000@hamster.lee.net>

On Friday, May, 2001-05-18 at 20:42:57, Shaun Thomas wrote:
> On Fri, 18 May 2001, Tom Lane wrote:
> 
> > Given the inherent inaccuracy of the cost estimates, I'd be real
> > hesitant to rely on them to suppress overly-expensive queries.
> 
> That's just it.  You don't have to be that accurate.  If an estimate
> goes into the millions or billions, something is obviously wrong with
> the query, period.  I'd just like to set a cutoff.
> 
> > What might make sense is a time limit on execution (after x amount
> > of time, give up and cancel the query).
> 
> That would work, but during that time the query is executing, that
> process is eating up cpu power and stealing resources from valid
> queries, possibly making them run slower, thus causing a chain of
> queries that could eventually time out as well.
> 
> > Note you could implement such a time limit purely on the client side,
> > which might be an easier and more flexible way to go.
> 
> That's just it.  PHP (our front end) has a 30 second time limit we
> have not overridden.  But we've found that after the PHP execution stops
> in disgust, the postgres thread keeps going until we restart the
> postgres back end.  That is simply unacceptable.  Especially
> considering any user on our system could feasibly (accidently or
> maliciously) take our database server to a crawl by writing a
> single bad query that may take days to track down.

I think that some interface to 'explain' returning a tuple of its values
could serve the purpose. You could first run the explain and then, when
the results are satisfiable run the query. It would need, off course, to
prepare some additional layer to test the estimations results, but could
prove usefull.

I'm not sure, that such an interface currently exists (it could be a little
tricky given the tree-form of 'explain' result) but I would benefit that
kind of tool myself...


regards

-- 
Marek Pętlicki <marpet@buy.pl>




view thread (8+ messages)

Message-ID: <20010518210631.A4103@marek.almaran.home>
Permalink:  ../20010518210631.A4103@marek.almaran.home/
Also on:    postgresql.org/message-id/20010518210631.A4103@marek.almaran.home

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: marpet@buy.pl, sthomas@townnews.com, tgl@sss.pgh.pa.us
  Subject: Re: Cost limit.
  In-Reply-To: <20010518210631.A4103@marek.almaran.home>
  References: <19867.990202907@sss.pgh.pa.us> <Pine.LNX.4.30.0105181141320.4466-100000@hamster.lee.net> <20010518210631.A4103@marek.almaran.home>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox