Re: is DB2 recursive query semantics inflationary?

From: Joseph,,, <joseph_at_aracnet.com>
Date: 8 Oct 2003 22:33:03 GMT
Message-ID: <bm23av0277j_at_enews2.newsguy.com>


mikharakiri_at_yahoo.com (Mikito Harakiri) writes:

>That's right: recursive view means that given temporary table state
>T(N) at the step N we calculate T(N+1)

>which means that temporary table is totally rewritten at each step
>rather than incrementally inflated as Graeme suggests.

>Am I missing some kind of optimization that reduces my execution to
>Graeme's? (My guess would be that not every kind of recursive union
>view would allow such transformation.)

First, you are confusing the language semantics with the evaluation procedure. The semantics of the recursive view is the view instance corresponding to T(n) where n is the least positive integer for which T(n) = T(n+1). This is called the least fixed point of the query.

At step N you calculate T(N+1). If you compute T(N+1) from scratch, it is called naive evaluation. For some queries, including all linear recursive queries, you can do semi-naive evaluation which incorporates the optimization of just computing the delta between T(N) and T(N+1) and adding that into the temporary table for T(N) to get T(N+1).

Hope that helps.

Joseph Received on Thu Oct 09 2003 - 00:33:03 CEST

Original text of this message