Re: Sql to Relational Algebra

From: Roy Hann <rhann_at_globalnet.co.uk>
Date: Mon, 21 Jul 2003 10:13:49 +0000 (UTC)
Message-ID: <bfgecs$kvb$1_at_sparta.btinternet.com>


"Bob Badour" <bbadour_at_golden.net> wrote in message news:brnSa.1072$jp6.179816497_at_mantis.golden.net... [snip]

>

> The latter advantage is particularly important for usability. Years ago,
> Fabian Pascal did a comparison of different SQL dbms's ability to provide
> good, consistent performance for logically equivalent queries using
> different redundant elements of SQL. If I recall correctly, the dbms that
> could achieve the fastest performance would also deliver the worst
> performance depending on how the user expressed the query. Ingres
delivered
> the most consistent performance because, at the time, it supported SQL by
> translating it to QUEL.

I am never one to downplay Ingres' manifold virtues, but let me point out that the last statement above stopped being true more than a decade ago.

Ingres only briefly translated SQL into QUEL. That was the approach taken in the later versions of Release 5, which came out in the late eighties. Since Release 6, and onwards, Ingres processes SQL directly (although QUEL is still fully supported).

Ingres still does an excellent job of translating SQL queries into a canonical form that leads to the same (optimal) plan. So much so that in our Advanced High-Performance Ingres programming course we tell students that if they find two logically equivalent, unambiguous queries, that lead to different query plans, then that is by definition an Ingres bug. The corollary to that is that when we teach query tuning, we tell the students that it is (practically) futile to attempt to re-write the query. If it correctly described the required data in the first place, then all equivalent formulations should lead to the same (optimal) plan. There are some trivial exceptions to this general rule, but for most purposes it is a true statement.

Bob's statement is not entirely incorrect though. The Ingres engine does include logic that was originally there to support QUEL, and the parser and the optimizer can both exploit it when processing SQL, but there is no intermediate translation to QUEL code. It works more like the original poster suggested he wanted to do things.

Roy Hann (rhann at rationalcommerce dot com) Rational Commerce Ltd.
www.rationalcommerce.com
"Ingres development, tuning, and training experts" Received on Mon Jul 21 2003 - 12:13:49 CEST

Original text of this message