181 lines
11 KiB
HTML
181 lines
11 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="Additional database monitor examples" />
|
|
<meta name="abstract" content="The following are additional ideas or examples on how to extract information from the performance monitor statistics. All of the examples assume data has been collected in LIB/PERFDATA and the documented views have been created." />
|
|
<meta name="description" content="The following are additional ideas or examples on how to extract information from the performance monitor statistics. All of the examples assume data has been collected in LIB/PERFDATA and the documented views have been created." />
|
|
<meta name="DC.subject" content="database monitor, examples" />
|
|
<meta name="keywords" content="database monitor, examples" />
|
|
<meta name="DC.Relation" scheme="URI" content="dbmonexamples.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="rzajqmon4" />
|
|
<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>Additional database monitor examples</title>
|
|
</head>
|
|
<body id="rzajqmon4"><a name="rzajqmon4"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Additional database monitor examples</h1>
|
|
<div><p>The following are additional ideas or examples on how to extract
|
|
information from the performance monitor statistics. All of the examples assume
|
|
data has been collected in LIB/PERFDATA and the documented views have been
|
|
created.</p>
|
|
<div class="section"> <ol><li>How many queries are performing dynamic replans? <pre> <strong>SELECT</strong> COUNT(*)
|
|
<strong>FROM</strong> LIB/QQQ1000
|
|
<strong>WHERE</strong> Dynamic_Replan_Reason_Code <> 'NA'</pre>
|
|
</li>
|
|
<li>What is the statement text and the reason for the dynamic replans? <pre> <strong>SELECT</strong> Dynamic_Replan_Reason_Code, Statement_Text_Long
|
|
<strong>FROM</strong> LIB/QQQ1000
|
|
<strong>WHERE</strong> Dynamic_Replan_Reason_Code <> 'NA'</pre>
|
|
<div class="note"><span class="notetitle">Note:</span> You
|
|
need to refer to the description of column Dynamic_Replan_Reason_Code for
|
|
definitions of the dynamic replan reason codes.</div>
|
|
</li>
|
|
<li>How many indexes have been created over LIB1/TBL1? <pre> <strong>SELECT</strong> COUNT(*)
|
|
<strong>FROM</strong> LIB/QQQ3002
|
|
<strong>WHERE</strong> System_Table_Schema = 'LIB1'
|
|
<strong>AND</strong> System_Table_Name = 'TBL1'</pre>
|
|
</li>
|
|
<li>What key columns are used for all indexes created over LIB1/TBL1 and what
|
|
is the associated SQL statement text? <pre><strong>SELECT</strong> A.System_Table_Schema, A.System_Table_Name,
|
|
A.Index_Advised_Columns, B.Statement_Text_Long
|
|
<strong>FROM</strong> LIB/QQQ3002 A, LIB/QQQ1000 B
|
|
<strong>WHERE</strong> A.Join_Column = B.Join_Column
|
|
<strong>AND</strong> A.Unique_Count = B.Unique_Count
|
|
<strong>AND</strong> A.System_Table_Schema = 'LIB1'
|
|
<strong>AND</strong> A.System_Table_Name = 'TBL1' </pre>
|
|
<div class="note"><span class="notetitle">Note:</span> This query
|
|
shows key columns only from queries executed using SQL.</div>
|
|
</li>
|
|
<li>What key columns are used for all indexes created over LIB1/TBL1 and what
|
|
was the associated SQL statement text or query open ID? <pre><strong>SELECT</strong> A.System_Table_Schema, A.System_Table_Name, A.Index_Advised_Columns,
|
|
B.Open_Id, C.Statement_Text_Long
|
|
<strong>FROM</strong> LIB/QQQ3002 A <strong>INNER JOIN</strong> LIB/QQQ3014 B
|
|
<strong>ON</strong> (A.Join_Column = B.Join_Column <strong>AND</strong>
|
|
A.Unique_Count = B.Unique_Count)
|
|
<strong>LEFT OUTER JOIN</strong> LIB/QQQ1000 C
|
|
<strong>ON</strong> (A.Join_Column = C.Join_Column <strong>AND</strong>
|
|
A.Unique_Count = C.Unique_Count)
|
|
<strong>WHERE</strong> A.System_Table_Schema <strong>LIKE</strong> '%'
|
|
<strong>AND</strong> A.System_Table_Name = '%' </pre>
|
|
<div class="note"><span class="notetitle">Note:</span> This query shows
|
|
key columns from all queries on the server.</div>
|
|
</li>
|
|
<li>What types of SQL statements are being performed? Which are performed
|
|
most frequently? <pre><strong>SELECT</strong> <strong>CASE</strong> Statement_Function
|
|
<strong>WHEN</strong> 'O' <strong>THEN</strong> 'Other'
|
|
<strong>WHEN</strong> 'S' <strong>THEN</strong> 'Select'
|
|
<strong>WHEN</strong> 'L' <strong>THEN</strong> 'DDL'
|
|
<strong>WHEN</strong> 'I' <strong>THEN</strong> 'Insert'
|
|
<strong>WHEN</strong> 'U' <strong>THEN</strong> 'Update'
|
|
<strong>ELSE</strong> 'Unknown'
|
|
<strong>END</strong>, COUNT(*)
|
|
<strong>FROM</strong> LIB/QQQ1000
|
|
<strong>GROUP BY</strong> Statement_Function
|
|
<strong>ORDER BY</strong> 2 DESC </pre>
|
|
</li>
|
|
<li>Which SQL queries are the most time consuming? Which user is running
|
|
these queries? <pre><strong>SELECT</strong> (End_Timestamp - Start_Timestamp), Job_User,
|
|
Current_User_Profile, Statement_Text_Long
|
|
<strong>FROM</strong> LIB/QQQ1000
|
|
<strong>ORDER BY</strong> 1 <strong>DESC</strong></pre>
|
|
</li>
|
|
<li>Which queries are the most time consuming? <pre><strong>SELECT</strong> (A.Open_Time + B.Clock_Time_to_Return_All_Rows),
|
|
A.Open_Id, C.Statement_Text_Long
|
|
<strong>FROM</strong> LIB/QQQ3014 A <strong>LEFT OUTER JOIN</strong> LIB/QQQ3019 B
|
|
<strong>ON</strong> (A.Join_Column = B.Join_Column <strong>AND</strong>
|
|
A.Unique_Count = B.Unique_Count)
|
|
<strong>LEFT OUTER JOIN</strong> LIB/QQQ1000 C
|
|
<strong>ON</strong> (A.Join_Column = C.Join_Column <strong>AND</strong>
|
|
A.Unique_Count = C.Unique_Count)
|
|
<strong>ORDER BY</strong> 1 <strong>DESC</strong> </pre>
|
|
<div class="note"><span class="notetitle">Note:</span> This example assumes detail
|
|
data was collected (STRDBMON TYPE(*DETAIL)). </div>
|
|
</li>
|
|
<li>Show the data for all SQL queries with the data for each SQL query logically
|
|
grouped together. <pre><strong>SELECT</strong> A.*
|
|
<strong>FROM</strong> LIB/PERFDATA A, LIB/QQQ1000 B
|
|
<strong>WHERE</strong> A.QQJFLD = B.Join_Column
|
|
<strong>AND</strong> A.QQUCNT = B.Unique_Count</pre>
|
|
<div class="note"><span class="notetitle">Note:</span> This might be used
|
|
within a report that will format the interesting data into a more readable
|
|
format. For example, all reason code columns can be expanded by the report
|
|
to print the definition of the reason code (that is, physical column QQRCOD
|
|
= 'T1' means a table scan was performed because no indexes exist over the
|
|
queried table).</div>
|
|
</li>
|
|
<li>How many queries are being implemented with temporary tables because a
|
|
key length of greater than 2000 bytes or more than 120 key columns was specified
|
|
for ordering? <pre><strong>SELECT</strong> <strong>COUNT</strong>(*)
|
|
<strong>FROM</strong> LIB/QQQ3004
|
|
<strong>WHERE</strong> Reason_Code = 'F6'</pre>
|
|
</li>
|
|
<li>Which SQL queries were implemented with nonreusable ODPs? <pre><strong>SELECT</strong> B.Statement_Text_Long
|
|
<strong>FROM</strong> LIB/QQQ3010 A, LIB/QQQ1000 B
|
|
<strong>WHERE</strong> A.Join_Column = B.Join_Column
|
|
<strong>AND</strong> A.Unique_Count = B.Unique_Count
|
|
<strong>AND</strong> A.ODP_Implementation = 'N';</pre>
|
|
</li>
|
|
<li>What is the estimated time for all queries stopped by the query governor?
|
|
<pre><strong>SELECT</strong> Estimated_Processing_Time, Open_Id
|
|
<strong>FROM</strong> LIB/QQQ3014
|
|
<strong>WHERE</strong> Stopped_By_Query_Governor = 'Y' </pre>
|
|
<div class="note"><span class="notetitle">Note:</span> This example
|
|
assumes detail data was collected (STRDBMON TYPE(*DETAIL)). </div>
|
|
</li>
|
|
<li>Which queries estimated time exceeds actual time? <pre><strong>SELECT</strong> A.Estimated_Processing_Time,
|
|
(A.Open_Time + B.Clock_Time_to_Return_All_Rows),
|
|
A.Open_Id, C.Statement_Text_Long
|
|
<strong>FROM</strong> LIB/QQQ3014 A <strong>LEFT OUTER JOIN</strong> LIB/QQQ3019 B
|
|
<strong>ON</strong> (A.Join_Column = B.Join_Column <strong>AND</strong>
|
|
A.Unique_Count = B.Unique_Count)
|
|
<strong>LEFT OUTER JOIN</strong> LIB/QQQ1000 C
|
|
<strong>ON</strong> (A.Join_Column = C.Join_Column <strong>AND</strong>
|
|
A.Unique_Count = C.Unique_Count)
|
|
<strong>WHERE</strong> A.Estimated_Processing_Time/1000 >
|
|
(A.Open_Time + B.Clock_Time_to_Return_All_Rows)</pre>
|
|
<div class="note"><span class="notetitle">Note:</span> This
|
|
example assumes detail data was collected (STRDBMON TYPE(*DETAIL)). </div>
|
|
</li>
|
|
<li>Should a PTF for queries that perform UNION exists be applied. It should
|
|
be applied if any queries are performing UNION. Do any of the queries perform
|
|
this function? <pre> <strong>SELECT</strong> COUNT(*)
|
|
<strong>FROM</strong> QQQ3014
|
|
<strong>WHERE</strong> Has_Union = 'Y'</pre>
|
|
<div class="note"><span class="notetitle">Note:</span> If result is greater than
|
|
0, the PTF should be applied.</div>
|
|
</li>
|
|
<li>You are a system administrator and an upgrade to the next release is planned.
|
|
You want to compare data from the two releases. <ul><li>Collect data from your application on the current release and save this
|
|
data in LIB/CUR_DATA</li>
|
|
<li>Move to the next release</li>
|
|
<li>Collect data from your application on the new release and save this data
|
|
in a different table: LIB/NEW_DATA</li>
|
|
<li>Write a program to compare the results. You will need to compare the
|
|
statement text between the rows in the two tables to correlate the data.</li>
|
|
</ul>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dbmonexamples.htm" title="The iSeries navigator interface provides a powerful tool for gathering and analyzing performance monitor data using database monitor. However, you may want to do your own analysis of the database monitor files.">Database monitor examples</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |