db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r453729 - /db/derby/docs/trunk/src/tuning/ctuntransform36623.dita
Date Fri, 06 Oct 2006 19:05:28 GMT
Author: jta
Date: Fri Oct  6 12:05:27 2006
New Revision: 453729

URL: http://svn.apache.org/viewvc?view=rev&rev=453729
Log:
DERBY-1875 Updates to the Tuning Guide based on the 10.2 doc review.

Patch derby1875_1.diff contributed by Laura Stewart <scotsmatrix@gmail.com>.

Modified:
    db/derby/docs/trunk/src/tuning/ctuntransform36623.dita

Modified: db/derby/docs/trunk/src/tuning/ctuntransform36623.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/tuning/ctuntransform36623.dita?view=diff&rev=453729&r1=453728&r2=453729
==============================================================================
--- db/derby/docs/trunk/src/tuning/ctuntransform36623.dita (original)
+++ db/derby/docs/trunk/src/tuning/ctuntransform36623.dita Fri Oct  6 12:05:27 2006
@@ -1,4 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
+ 
+<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN"
+ "../dtd/concept.dtd">
 <!-- 
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
@@ -15,50 +18,60 @@
 See the License for the specific language governing permissions and  
 limitations under the License.
 -->
-<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "../dtd/concept.dtd">
-<concept xml:lang="en-us" id="ctuntransform36623">
+<concept id="ctuntransform36623" xml:lang="en-us">
 <title>Predicates pushed into views or derived tables</title>
 <prolog><metadata>
-<keywords>
-<indexterm>Predicates<indexterm>pushed down into views</indexterm></indexterm>
+<keywords><indexterm>predicates<indexterm>pushed down into views</indexterm></indexterm>
 </keywords>
-</metadata>
-</prolog>
+</metadata></prolog>
 <conbody>
-<p>An SQL statement that references a view can also include a predicate.
-Consider the view <i>v2 (a,b)</i>:  
-<codeblock><b>CREATE VIEW v2(a,b) AS
+<p>An SQL statement that references a view can also include a predicate. Consider
+the view <i>v2 (a,b)</i>:   <codeblock>CREATE VIEW v2(a,b) AS
 SELECT sales_person, MAX(sales)
 FROM Sales
-GROUP BY sales_person</b></codeblock></p>
-<p>The following statement references the view and includes a predicate:  
-<codeblock><b>SELECT *
+GROUP BY sales_person</codeblock></p>
+<p>The following statement references the view and includes a predicate: 
+ <codeblock>SELECT *
 FROM v2
-WHERE a = 'LUCCHESSI'</b></codeblock></p>
-<p>When <ph conref="tunconrefs.dita#prod/productshortname"></ph> transforms
that statement by first transforming the view
-into a derived table, it places the predicate at the top level of the new
-query, outside the scope of the derived table:  
-<codeblock><b>SELECT a, b
-FROM (SELECT sales_person, MAX(sales) FROM Sales
-GROUP BY sales_person) v2(a, b) WHERE a = 'LUCCHESSI'</b></codeblock></p>
-<p>In the example in the preceding section (see <xref href="ctuntransform22576.dita#ctuntransform22576"/>),
<ph conref="tunconrefs.dita#prod/productshortname"></ph> was able to flatten the
derived table into the
-main SELECT, so the predicate in the outer SELECT could be evaluated at a
-useful point in the query. This is not possible in this example, because the
-underlying view does not satisfy all the requirements of view flattening.</p>
+WHERE a = 'LUCCHESSI'</codeblock></p>
+<p>When <ph conref="tunconrefs.dita#prod/productshortname"></ph> transforms
+that statement by first transforming the view into a derived table, it places
+the predicate at the top level of the new query, outside the scope of the
+derived table:   <codeblock>SELECT a, b 
+FROM (SELECT sales_person, MAX(sales) 
+   FROM Sales 
+   WHERE sales_person = 'LUCCHESSI' 
+   GROUP BY sales_person) 
+   v1(a, b)
+</codeblock></p>
+<p>In the example in the preceding section (see <xref href="ctuntransform22576.dita#ctuntransform22576"></xref>),
<ph
+conref="tunconrefs.dita#prod/productshortname"></ph> was able to flatten the
+derived table into the main SELECT, so the predicate in the outer SELECT could
+be evaluated at a useful point in the query. This is not possible in this
+example, because the underlying view does not satisfy all the requirements
+of view flattening.</p>
 <p>However, if the source of all of the column references in a predicate is
-a <xref href="ctuntransform13966.dita#ctuntransform13966/rtuntransform13785">simple
column reference</xref> in the underlying view or
-table, <ph conref="tunconrefs.dita#prod/productshortname"></ph> is able to <i>push</i>
the predicate <i>down</i> to the underlying view. Pushing down means that the
-qualification described by the predicate can be evaluation when the view is
-being evaluated. In our example, the column reference in the outer predicate, <i>a</i>,
in the underlying view is a <xref href="ctuntransform13966.dita#ctuntransform13966/rtuntransform13785">simple
column reference</xref> to the underlying <xref href="ctuntransform13966.dita#ctuntransform13966/rtuntransform41494">base
table</xref>.
-So the final transformation of this statement after predicate push-down is:
-<codeblock><b>SELECT a, b
+a <xref href="ctuntransform13966.dita#ctuntransform13966/rtuntransform13785">simple
+column reference</xref> in the underlying view or table, <ph conref="tunconrefs.dita#prod/productshortname"></ph>
is
+able to <i>push</i> the predicate <i>down</i> to the underlying view.
Pushing
+down means that the qualification described by the predicate can be evaluated
+when the view is being evaluated. In our example, the column reference in
+the outer predicate, <i>a</i>, in the underlying view is a <xref href="ctuntransform13966.dita#ctuntransform13966/rtuntransform13785">simple
+column reference</xref> to the underlying <xref href="ctuntransform13966.dita#ctuntransform13966/rtuntransform41494">base
+table</xref>. So the final transformation of this statement after predicate
+pushdown is: <codeblock>SELECT a, b 
 FROM (SELECT sales_person, MAX(sales) from Sales 
-WHERE city_id = 2 GROUP BY city_id) v1(a, b)</b></codeblock></p>
-<p>Without the transformation, <ph conref="tunconrefs.dita#prod/productshortname"></ph>
would have to scan the entire table <i>t1</i> to form all the groups, only to
throw out all but one
-of the groups. With the transformation, <ph conref="tunconrefs.dita#prod/productshortname"></ph>
is able to make that qualification
-part of the derived table.</p>
-<p>If there were a predicate that referenced column <i>b</i>,
-it could not be pushed down, because in the underlying view, column <i>b</i>
is not a <xref href="ctuntransform13966.dita#ctuntransform13966/rtuntransform13785">simple
column reference</xref>.</p>
-<p>Predicate push-down transformation includes predicates that reference multiple
+WHERE sales_person = 'LUCCHESSI' 
+GROUP BY sales_person) v1(a, b)</codeblock></p>
+<p>Without the transformation, <ph conref="tunconrefs.dita#prod/productshortname"></ph>
would
+have to scan the entire table <i>t1</i> to form all the groups, only to throw
+out all but one of the groups. With the transformation, <ph conref="tunconrefs.dita#prod/productshortname"></ph>
is
+able to make that qualification part of the derived table.</p>
+<p>If there were a predicate that referenced column <i>b</i>, it could
not
+be pushed down, because in the underlying view, column <i>b</i> is not a <xref
+href="ctuntransform13966.dita#ctuntransform13966/rtuntransform13785">simple
+column reference</xref>.</p>
+<p>Predicate pushdown transformation includes predicates that reference multiple
 tables from an underlying join.</p>
-</conbody></concept>
+</conbody>
+</concept>



Mime
View raw message