ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzajq_5.4.0.1/rzajqrecursive.htm

70 lines
6.4 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Recursive query optimization" />
<meta name="abstract" content="Certain applications and data are recursive by nature. Examples of such applications are a bill-of-material, reservation, trip planner or networking planning system where data in one results row has a natural relationship (call it a parent, child relationship) with data in another row or rows. Although the kinds of recursion implemented in these systems can be performed by using SQL Stored Procedures and temporary results tables, the use of a recursive query to facilitate the access of this hierarchical data can lead to a more elegant and better performing application." />
<meta name="description" content="Certain applications and data are recursive by nature. Examples of such applications are a bill-of-material, reservation, trip planner or networking planning system where data in one results row has a natural relationship (call it a parent, child relationship) with data in another row or rows. Although the kinds of recursion implemented in these systems can be performed by using SQL Stored Procedures and temporary results tables, the use of a recursive query to facilitate the access of this hierarchical data can lead to a more elegant and better performing application." />
<meta name="DC.Relation" scheme="URI" content="per0001.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajqrcteexample.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajqrcteinitial.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajqrctepredicate.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajqrctesearch.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajqrctecycle.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajqrctesmp.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rzajqrecursive" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Recursive query optimization</title>
</head>
<body id="rzajqrecursive"><a name="rzajqrecursive"><!-- --></a>
<img src="./delta.gif" alt="Start of change" /><!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Recursive query optimization</h1>
<div><p>Certain applications and data are recursive by nature. Examples
of such applications are a bill-of-material, reservation, trip
planner or networking planning system where data in one results row has a
natural relationship (call it a parent, child relationship) with data in another
row or rows. Although the kinds of recursion implemented in these systems
can be performed by using SQL Stored Procedures and temporary results tables,
the use of a recursive query to facilitate the access of this hierarchical
data can lead to a more elegant and better performing application.</p>
<div class="section"><p>Recursive queries can be implemented by defining either a Recursive
Common Table Expression (RCTE) or a Recursive View.</p>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rzajqrcteexample.htm">Recursive query example</a></strong><br />
A recursive query is one that is defined by a Union All with an initialization fullselect that seeds the recursion and an iterative fullselect that contains a direct reference to itself in the FROM clause.</li>
<li class="ulchildlink"><strong><a href="rzajqrcteinitial.htm">Multiple initialization and iterative fullselects</a></strong><br />
The use of multiple initialization and iterative fullselects specified in the recursive query definition allows for a multitude of data sources and separate selection requirements to feed the recursion process.</li>
<li class="ulchildlink"><strong><a href="rzajqrctepredicate.htm">Predicate Pushing</a></strong><br />
When processing most queries with a non-recursive common table expressions or views, local predicates specified on the main query are pushed down so fewer records need to be materialized. Pushing local predicates from the main query in to the defined recursive part of the query (through the Union ALL), however, may considerably alter the process of recursion itself. So as a general rule, the Union All specified in a recursive query is currently a predicate fence and predicates are not pushed down or up, through this fence.</li>
<li class="ulchildlink"><strong><a href="rzajqrctesearch.htm">Specifying SEARCH consideration</a></strong><br />
Certain applications dealing with hierarchical, recursive data, may have a requirement in how data is processed: by depth or by breadth.</li>
<li class="ulchildlink"><strong><a href="rzajqrctecycle.htm">Specifying CYCLE considerations</a></strong><br />
Recognizing that data in the tables used in a recursive query might be cyclic in nature is important to preventing infinite loops.</li>
<li class="ulchildlink"><strong><a href="rzajqrctesmp.htm">SMP and recursive queries</a></strong><br />
Recursive queries can benefit as much from symmetric multiprocessing (SMP) as do other queries on the system.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="per0001.htm" title="This overview of the query optimizer provides guidelines for designing queries that will perform and will use server resources more efficiently.">Processing queries: Overview</a></div>
</div>
</div>
<img src="./deltaend.gif" alt="End of change" /></body>
</html>