78 lines
4.2 KiB
HTML
78 lines
4.2 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="reference" />
|
|
<meta name="DC.Title" content="Example: Query tool C" />
|
|
<meta name="abstract" content="In this example, the complex decision support-type queries ended up making the query run longer." />
|
|
<meta name="description" content="In this example, the complex decision support-type queries ended up making the query run longer." />
|
|
<meta name="DC.Relation" scheme="URI" content="rzaiktoolsbadperf.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="odbcquerytoolc" />
|
|
<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>Example: Query tool C</title>
|
|
</head>
|
|
<body id="odbcquerytoolc"><a name="odbcquerytoolc"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Query tool C</h1>
|
|
<div><p>In this example, the complex decision support-type queries ended
|
|
up making the query run longer.</p>
|
|
<div class="section"><p>Query tool C allows complex decision support-type queries to be
|
|
made by defining complex query criteria with a point-and-click interface.
|
|
You might end up with <span class="keyword">SQL</span> that
|
|
looks like this for a query: </p>
|
|
<pre> SELECT A.COL1, B.COL2, C.COL3 , etc...
|
|
FROM A, B, C, etc...
|
|
WHERE many complex inner and outer joins are specified</pre>
|
|
</div>
|
|
<div class="section"><p>That you did not have to write this complex query is advantageous,
|
|
but beware that your tool may not actually process this statement. For example,
|
|
one tool might pass this statement directly to the ODBC driver, while another
|
|
splits up the query into many individual queries, and processes the results
|
|
at the client, like this: </p>
|
|
<pre> SQLExecDirect("SELECT * FROM A")
|
|
SQLFetch() all rows from A
|
|
SQLExecDirect("SELECT * FROM B")
|
|
SQLFetch() all rows from B
|
|
|
|
Process the first join at the client
|
|
|
|
SQLExecDirect("SELECT * FROM C")
|
|
SQLFetch() all rows from C
|
|
|
|
Process the next join at the client
|
|
.
|
|
.
|
|
.
|
|
And so on...</pre>
|
|
</div>
|
|
<div class="section"><p>This approach can lead to excessive amounts of data being passed
|
|
to the client, which will adversely affect performance. In one real-world
|
|
example, a programmer thought that a 10-way inner/outer join was being passed
|
|
to ODBC, with four rows being returned. What actually was passed, however,
|
|
was 10 simple SELECT statements and all the FETCHes associated with them.
|
|
The net result of four rows was achieved only after <em>81,000</em> ODBC calls
|
|
were made by the tool. The programmer initially thought that ODBC was responsible
|
|
for the slow performance, until the ODBC trace was revealed.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaiktoolsbadperf.htm" title="The following examples demonstrate performance problems that are associated with writing SQL and ODBC calls that do NOT take advantage of a unique feature of a particular ODBC driver or the server database management system.">Examples: Common tool behaviors that degrade ODBC performance</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |