Re: fool-toleranced optimizer - Mailing list pgsql-hackers

From Kevin Brown
Subject Re: fool-toleranced optimizer
Date
Msg-id 20050310000137.GB30977@filer
Whole thread Raw
In response to Re: fool-toleranced optimizer  (Neil Conway <neilc@samurai.com>)
Responses Re: fool-toleranced optimizer  (Greg Stark <gsstark@mit.edu>)
List 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@sysexperts.com


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1528: Rows returned that should be excluded by WHERE clause
Next
From: Tatsuo Ishii
Date:
Subject: Re: pgpool question