Re: fool-toleranced optimizer

From: Kevin Brown <kevin(at)sysexperts(dot)com>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fool-toleranced optimizer
Date: 2005-03-10 00:01:37
Message-ID: 20050310000137.GB30977@filer
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Neil Conway wrote:
> Simon Riggs wrote:
> >Oleg is saying that the optimizer doesn't protect against foolish SQL
> >requests. His query is an example of a foolishly written query.
>
> IMHO calling this a "foolishly written query" is completely arbitrary. I
> can imagine plenty of applications for which a cartesian join makes
> sense. In this case the user didn't write the query they meant to write
> -- but it is surely hopeless to prevent that in the general case :)

Sure, but this case, at least, is (hopefully) easily detectable (as
such things go), has a high cost when it occurs, and is *usually* not
what the user intended.

Hence, it makes sense to go ahead and run the query, but issue a
warning at the very beginning, e.g. "WARNING: query JOINs tables <list
of tables> without otherwise referencing or making use of those
tables. This may cause excessively poor performance of the query".

That said, the real question is whether or not it's worth putting in
the effort to detect this condition and issue the warning. I'd say
probably not, but if this is a big enough itch for someone then why
should we discourage them from coding up a fix?

--
Kevin Brown kevin(at)sysexperts(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2005-03-10 01:25:17 Re: pgpool question
Previous Message Tom Lane 2005-03-09 23:40:47 Re: BUG #1528: Rows returned that should be excluded by WHERE clause