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                                           [EMAIL PROTECTED]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to