Re: fool-toleranced optimizer

From: Neil Conway <neilc(at)samurai(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fool-toleranced optimizer
Date: 2005-03-09 11:38:35
Message-ID: 422EE03B.3080706@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 :)

> It seems a reasonable that there might be a GUC such as
> enable_cartesian = on (by default)

I think the bar for adding a new GUC ought to be significantly higher
than that.

In any case, when this problem does occur, it is obvious to the user
that something is wrong, and no harm is done. Given a complex SQL query,
it might take a bit of examination to determine which join clause is
missing -- but the proper way to fix that is better query visualization
tools (perhaps similar RH's Visual Explain, for example). This would
solve the general problem: "the user didn't write the query they
intended to write", rather than a very narrow subset ("the user forgot a
join clause and accidentally computed a cartesian product").

-Neil

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2005-03-09 12:23:34 Re: fool-toleranced optimizer
Previous Message Simon Riggs 2005-03-09 11:07:15 Re: fool-toleranced optimizer