Re: fool-toleranced optimizer

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Neil Conway <neilc(at)samurai(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:07:15
Message-ID: 1110366435.6117.266.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2005-03-09 at 11:02 +1100, Neil Conway wrote:
> Oleg Bartunov wrote:
> > I just noticed a little optimizer problem - in second query there is
> > unused 'tycho t2' table alias which gets backend buried.
>
> It's not an "unused table alias", it is specifying the cartesian product
> of `tycho' with itself. I don't see how this is an optimizer problem:
> it's a perfectly legitimate query, albeit one that is unlikely to
> execute very quickly.

Turn this thought around a bit and the request makes sense.

Oleg is saying that the optimizer doesn't protect against foolish SQL
requests. His query is an example of a foolishly written query.

It is reasonably common SQL mistake to inadvertently request a cartesian
product join, when that was not actually desired. This is mostly
prevalent in Data Warehouse situations where people are attempting to
request complex result sets.

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

If an admin felt that this was a problem, they could enable it for their
novice users only, or perhaps across the whole system.

If enable_cartesian = off, then queries with cartesian product joins
would be made to fail. Which should be easy to detect in early stages of
optimization.

So, Oleg, for me, the request makes sense, though somebody would need to
code it...

Best Regards, Simon Riggs

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2005-03-09 11:38:35 Re: fool-toleranced optimizer
Previous Message Jeff Davis 2005-03-09 09:23:39 Re: About b-tree usage