110 lines
9.0 KiB
HTML
110 lines
9.0 KiB
HTML
|
<?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="concept" />
|
||
|
<meta name="DC.Title" content="Processing queries: Overview" />
|
||
|
<meta name="abstract" content="This overview of the query optimizer provides guidelines for designing queries that will perform and will use server resources more efficiently." />
|
||
|
<meta name="description" content="This overview of the query optimizer provides guidelines for designing queries that will perform and will use server resources more efficiently." />
|
||
|
<meta name="DC.subject" content="query optimizer, optimization, performance, using SQL, application programs, resource" />
|
||
|
<meta name="keywords" content="query optimizer, optimization, performance, using SQL, application programs, resource" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajqkickoff.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="perf30.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="gotips.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="apvalid.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="decmakrules.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="perf24.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajqdistinct.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="groupopt.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="orderingopt.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="viewopt.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajqmqt.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzajqrecursive.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="per0001" />
|
||
|
<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>Processing queries: Overview</title>
|
||
|
</head>
|
||
|
<body id="per0001"><a name="per0001"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Processing queries: Overview</h1>
|
||
|
<div><p>This overview of the query optimizer provides guidelines for designing
|
||
|
queries that will perform and will use server resources more efficiently.</p>
|
||
|
<div class="p">This overview covers queries that are optimized by the query optimizer
|
||
|
and includes interfaces such as SQL, OPNQRYF, APIs (QQQQRY), ODBC, and Query/400
|
||
|
queries. Whether you apply the guidelines, the query results will still be
|
||
|
correct. <div class="note"><span class="notetitle">Note:</span> The information in this overview is complex. You might find
|
||
|
it helpful to experiment with an <span class="keyword">iSeries™</span> server
|
||
|
as you read this information to gain a better understanding of the concepts.</div>
|
||
|
</div>
|
||
|
<p>When you understand how <span class="keyword">DB2 Universal Database™ for iSeries</span> processes
|
||
|
queries, it is easier to understand the performance impacts of the guidelines
|
||
|
discussed in this overview. There are two major components of <span class="keyword">DB2 Universal Database for iSeries</span> query
|
||
|
processing:</p>
|
||
|
<ul><li>How the server accesses data. <p>These methods are the algorithms that
|
||
|
are used to retrieve data from the disk. The methods include index usage and
|
||
|
row selection techniques. In addition, parallel access methods are available
|
||
|
with the <span class="keyword">DB2<sup>®</sup> UDB Symmetric Multiprocessing</span> operating
|
||
|
system feature.</p>
|
||
|
</li>
|
||
|
<li>Query optimizer.<p>The query optimizer identifies the valid techniques
|
||
|
which can be used to implement the query and selects the most efficient technique.</p>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="perf30.htm">How the query optimizer makes your queries more efficient</a></strong><br />
|
||
|
Data manipulation statements such as SELECT specify only what data the user wants, not how to retrieve that data. This path to the data is chosen by the optimizer and stored in the access plan. You should understand the techniques employed by the query optimizer for performing this task.</li>
|
||
|
<li class="ulchildlink"><strong><a href="gotips.htm">General query optimization tips</a></strong><br />
|
||
|
Here are some tips to help your queries run as fast as possible.</li>
|
||
|
<li class="ulchildlink"><strong><a href="apvalid.htm">Access plan validation</a></strong><br />
|
||
|
An access plan is a control structure that describes the actions necessary to satisfy each query request. It contains information about the data and how to extract it. For any query, whenever optimization occurs, the query optimizer develops an optimized plan of how to access the requested data.</li>
|
||
|
<li class="ulchildlink"><strong><a href="decmakrules.htm">Single table optimization</a></strong><br />
|
||
|
At run time, the optimizer chooses an optimal access method for
|
||
|
the query by calculating an<em> implementation cost</em> based on the current
|
||
|
state of the database. The optimizer uses 2 costs when making decisions:
|
||
|
an I/O cost and a CPU cost. The goal of the optimizer is to minimize both
|
||
|
I/O and CPU cost.</li>
|
||
|
<li class="ulchildlink"><strong><a href="perf24.htm">Join optimization</a></strong><br />
|
||
|
A join operation is a complex function that requires special attention
|
||
|
in order to achieve good performance. This section describes how <span class="keyword">DB2 Universal Database for iSeries</span> implements join queries and
|
||
|
how optimization choices are made by the query optimizer. It also describes
|
||
|
design tips and techniques which help avoid or solve performance problems.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rzajqdistinct.htm">Distinct optimization</a></strong><br />
|
||
|
Distinct is used to compare a value with another value.</li>
|
||
|
<li class="ulchildlink"><strong><a href="groupopt.htm">Grouping optimization</a></strong><br />
|
||
|
<span class="keyword">DB2 Universal Database for iSeries</span> has certain
|
||
|
techniques to use when the optimizer encounters grouping. The query optimizer
|
||
|
chooses its methods for optimizing your query.</li>
|
||
|
<li class="ulchildlink"><strong><a href="orderingopt.htm">Ordering optimization</a></strong><br />
|
||
|
This section describes how <span class="keyword">DB2 Universal Database for iSeries</span> implements
|
||
|
ordering techniques, and how optimization choices are made by the query optimizer.
|
||
|
The query optimizer can use either index ordering or a sort to implement ordering.</li>
|
||
|
<li class="ulchildlink"><strong><a href="viewopt.htm">View implementation</a></strong><br />
|
||
|
Views, derived tables (nested table expressions or NTEs), and common table expressions (CTEs) are implemented by the query optimizer using one of two methods.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rzajqmqt.htm">Materialized query table optimization</a></strong><br />
|
||
|
Materialized query tables (MQTs) (also referred to as automatic summary tables or materialized views) can provide performance enhancements for queries.</li>
|
||
|
<li class="ulchildlink"><strong><a href="rzajqrecursive.htm">Recursive query optimization</a></strong><br />
|
||
|
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.</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajqkickoff.htm" title="The goal of database performance tuning is to minimize the response time of your queries and to make the best use of your server's resources by minimizing network traffic, disk I/O, and CPU time. This goal can only be achieved by understanding the logical and physical structure of your data, understanding the applications used on your server, and understanding how the many conflicting uses of your database may impact database performance.">Performance and query optimization</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|