Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Extending my question. Was: The relational model and relational algebra - why did SQL become the industry standard?

Re: Extending my question. Was: The relational model and relational algebra - why did SQL become the industry standard?

From: Jan Hidders <jan.hidders_at_REMOVE.THIS.ua.ac.be>
Date: 11 Mar 2003 21:21:27 +0100
Message-ID: <3e6e4547.0@news.ruca.ua.ac.be>


Bob Badour wrote:
>"Jan Hidders" <jan.hidders_at_REMOVE.THIS.ua.ac.be> wrote in message
>news:3e6da66b.0_at_news.ruca.ua.ac.be...
>>
>> I'm not convinced that bags are never needed. [...] And if you are then
>> going to simulate them with sets then the cost might become negative
>> because the set-based optimizer might miss certain optimizations that
>> would have been easier to spot for a bag-based optimizer.
>
>Such as?

Such as combining two iterations over the same bag into one. It's pretty easy to see that

  SELECT f(x)
  FROM x IN
    SELECT g(y)
    FROM y IN Y

is the same as

  SELECT f(g(y))
  FROM y in Y

which is a simple straightforward rule in bag algebra. However, if you simulate that with sets the optimizer has to see that

  SELECT f(x) AS fx, COUNT(*) AS cnt
  FROM x IN
    SELECT g(y) AS fy, COUNT(*) AS cnt
    FROM y IN Y
    GROUP BY fy
  GROUP BY fx

is the same as

  SELECT f(g(y)) AS fx, COUNT(*) AS cnt
  FROM y IN Y
  GROUP BY fx

which is a lot less straightfoward.

Received on Tue Mar 11 2003 - 14:21:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US