source: trunk/phpgwapi/inc/adodb/docs/docs-perf.htm @ 2

Revision 2, 31.1 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4  <title>ADOdb Performance Monitoring Library</title>
5  <style type="text/css">
6body, td {
7/*font-family: Arial, Helvetica, sans-serif;*/
8font-size: 11pt;
9}
10pre {
11font-size: 9pt;
12background-color: #EEEEEE; padding: .5em; margin: 0px;
13}
14.toplink {
15font-size: 8pt;
16}
17  </style>
18</head>
19<body>
20<h3>The ADOdb Performance Monitoring Library</h3>
21<p>V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my)</p>
22<p><font size="1">This software is dual licensed using BSD-Style and
23LGPL. This means you can use it in compiled proprietary and commercial
24products.</font></p>
25<table border="1">
26  <tbody>
27    <tr>
28      <td><font color="red">Kindly note that the ADOdb home page has
29moved to <a href="http://adodb.sourceforge.net/">http://adodb.sourceforge.net/</a>
30because of the persistent unreliability of http://php.weblogs.com. <b>Please
31change your links</b>!</font></td>
32    </tr>
33  </tbody>
34</table>
35<p>Useful ADOdb links: <a href="http://adodb.sourceforge.net/#download">Download</a>
36&nbsp; <a href="http://adodb.sourceforge.net/#docs">Other Docs</a>
37</p>
38<h3>Introduction</h3>
39<p>This module, part of the ADOdb package, provides both CLI and HTML
40interfaces for viewing key performance indicators of your database.
41This is very useful because web apps such as the popular phpMyAdmin
42currently do not provide effective database health monitoring tools.
43The module provides the following: </p>
44<ul>
45  <li>A quick health check of your database server using <code>$perf-&gt;HealthCheck()</code>
46or <code>$perf-&gt;HealthCheckCLI()</code>. </li>
47  <li>User interface for performance monitoring, <code>$perf-&gt;UI()</code>.
48This UI displays:
49    <ul>
50      <li>the health check, </li>
51      <li>all SQL logged and their query plans, </li>
52      <li>a list of all tables in the current database</li>
53      <li>an interface to continiously poll the server for key
54performance indicators such as CPU, Hit Ratio, Disk I/O</li>
55      <li>a form where you can enter and run SQL interactively.</li>
56    </ul>
57  </li>
58  <li>Gives you an API to build database monitoring tools for a server
59farm, for example calling <code>$perf-&gt;DBParameter('data cache hit
60ratio')</code> returns this very important statistic in a database
61independant manner. </li>
62</ul>
63<p>ADOdb also has the ability to log all SQL executed, using <a
64 href="docs-adodb.htm#logsql">LogSQL</a>. All SQL logged can be
65analyzed through the performance monitor <a href="#ui">UI</a>. In the <i>View
66SQL</i> mode, we categorize the SQL into 3 types:
67</p>
68<ul>
69  <li><b>Suspicious SQL</b>: queries with high average execution times,
70and are potential candidates for rewriting</li>
71  <li><b>Expensive SQL</b>: queries with high total execution times
72(#executions * avg execution time). Optimizing these queries will
73reduce your database server load.</li>
74  <li><b>Invalid SQL</b>: queries that generate errors.</li>
75</ul>
76<p>Each query is hyperlinked to a description of the query plan, and
77every PHP script that executed that query is also shown.</p>
78<p>Please note that the information presented is a very basic database
79health check, and does not provide a complete overview of database
80performance. Although some attempt has been made to make it work across
81multiple databases in the same way, it is impossible to do so. For the
82health check, we do try to display the following key database
83parameters for all drivers:</p>
84<ul>
85  <li><b>data cache size</b> - The amount of memory allocated to the
86cache.</li>
87  <li><b>data cache hit ratio</b> - A measure of how effective the
88cache is, as a percentage. The higher, the better.</li>
89  <li><b>current connections</b> - The number of sessions currently
90connected to the database. </li>
91</ul>
92<p>You will need to connect to the database as an administrator to view
93most of the parameters. </p>
94<p>Code improvements as very welcome, particularly adding new database
95parameters and automated tuning hints.</p>
96<a name="usage"></a>
97<h3>Usage</h3>
98<p>Currently, the following drivers: <em>mysql</em>, <em>postgres</em>,
99<em>oci8</em>, <em>mssql</em>, <i>informix</i> and <em>db2</em> are
100supported. To create a new performance monitor, call NewPerfMonitor( )
101as demonstrated below: </p>
102<pre>&lt;?php<br>include_once('adodb.inc.php');<br>session_start(); <font
103 color="#006600"># session variables required for monitoring</font><br>$conn = ADONewConnection($driver);<br>$conn-&gt;Connect($server,$user,$pwd,$db);<br>$perf =&amp; NewPerfMonitor($conn);<br>$perf-&gt;UI($pollsecs=5);<br>?&gt;<br></pre>
104<p>It is also possible to retrieve a single database parameter:</p>
105<pre>$size = $perf-&gt;DBParameter('data cache size');<br></pre>
106<p>
107Thx to Fernando Ortiz for the informix module. </p>
108<h3>Methods</h3>
109<a name="ui"></a>
110<p><font face="Courier New, Courier, mono">function <b>UI($pollsecs=5)</b></font></p>
111<p>Creates a web-based user interface for performance monitoring. When
112you click on Poll, server statistics will be displayed every $pollsecs
113seconds. See <a href="#usage">Usage</a> above. </p>
114<p>Since 4.11, we allow users to enter and run SQL interactively via
115the "Run SQL" link. To disable this for security reasons, set this
116constant before calling $perf-&gt;UI(). </p>
117<p> </p>
118<pre>define('ADODB_PERF_NO_RUN_SQL',1);</pre>
119<p>Sample output follows below:</p>
120<table bgcolor="lightyellow" border="1" width="100%">
121  <tbody>
122    <tr>
123      <td> <b><a href="http://php.weblogs.com/adodb?perf=1">ADOdb</a>
124Performance Monitor</b> for localhost, db=test<br>
125      <font size="-1">PostgreSQL 7.3.2 on i686-pc-cygwin, compiled by
126GCC gcc (GCC) 3.2 20020927 (prerelease)</font></td>
127    </tr>
128    <tr>
129      <td> <a href="#">Performance Stats</a> &nbsp; <a href="#">View
130SQL</a> &nbsp; <a href="#">View Tables</a> &nbsp; <a href="#">Poll
131Stats</a></td>
132    </tr>
133  </tbody>
134</table>
135<table bgcolor="white" border="1">
136  <tbody>
137    <tr>
138      <td colspan="3">
139      <h3>postgres7</h3>
140      </td>
141    </tr>
142    <tr>
143      <td><b>Parameter</b></td>
144      <td><b>Value</b></td>
145      <td><b>Description</b></td>
146    </tr>
147    <tr bgcolor="#f0f0f0">
148      <td colspan="3"><i>Ratios</i> &nbsp;</td>
149    </tr>
150    <tr>
151      <td>statistics collector</td>
152      <td>TRUE</td>
153      <td>Value must be TRUE to enable hit ratio statistics (<i>stats_start_collector</i>,<i>stats_row_level</i>
154and <i>stats_block_level</i> must be set to true in postgresql.conf)</td>
155    </tr>
156    <tr>
157      <td>data cache hit ratio</td>
158      <td>99.7967555299239</td>
159      <td>&nbsp;</td>
160    </tr>
161    <tr bgcolor="#f0f0f0">
162      <td colspan="3"><i>IO</i> &nbsp;</td>
163    </tr>
164    <tr>
165      <td>data reads</td>
166      <td>125</td>
167      <td>&nbsp; </td>
168    </tr>
169    <tr>
170      <td>data writes</td>
171      <td>21.78125000000000000</td>
172      <td>Count of inserts/updates/deletes * coef</td>
173    </tr>
174    <tr bgcolor="#f0f0f0">
175      <td colspan="3"><i>Data Cache</i> &nbsp;</td>
176    </tr>
177    <tr>
178      <td>data cache buffers</td>
179      <td>640</td>
180      <td>Number of cache buffers. <a
181 href="http://www.varlena.com/GeneralBits/Tidbits/perf.html#basic">Tuning</a></td>
182    </tr>
183    <tr>
184      <td>cache blocksize</td>
185      <td>8192</td>
186      <td>(estimate)</td>
187    </tr>
188    <tr>
189      <td>data cache size</td>
190      <td>5M</td>
191      <td>&nbsp;</td>
192    </tr>
193    <tr>
194      <td>operating system cache size</td>
195      <td>80M</td>
196      <td>(effective cache size)</td>
197    </tr>
198    <tr bgcolor="#f0f0f0">
199      <td colspan="3"><i>Memory Usage</i> &nbsp;</td>
200    </tr>
201    <tr>
202      <td>sort buffer size</td>
203      <td>1M</td>
204      <td>Size of sort buffer (per query)</td>
205    </tr>
206    <tr bgcolor="#f0f0f0">
207      <td colspan="3"><i>Connections</i> &nbsp;</td>
208    </tr>
209    <tr>
210      <td>current connections</td>
211      <td>0</td>
212      <td>&nbsp;</td>
213    </tr>
214    <tr>
215      <td>max connections</td>
216      <td>32</td>
217      <td>&nbsp;</td>
218    </tr>
219    <tr bgcolor="#f0f0f0">
220      <td colspan="3"><i>Parameters</i> &nbsp;</td>
221    </tr>
222    <tr>
223      <td>rollback buffers</td>
224      <td>8</td>
225      <td>WAL buffers</td>
226    </tr>
227    <tr>
228      <td>random page cost</td>
229      <td>4</td>
230      <td>Cost of doing a seek (default=4). See <a
231 href="http://www.varlena.com/GeneralBits/Tidbits/perf.html#less">random_page_cost</a></td>
232    </tr>
233  </tbody>
234</table>
235<p><font face="Courier New, Courier, mono">function <b>HealthCheck</b>()</font></p>
236<p>Returns database health check parameters as a HTML table. You will
237need to echo or print the output of this function,</p>
238<p><font face="Courier New, Courier, mono">function <b>HealthCheckCLI</b>()</font></p>
239<p>Returns database health check parameters formatted for a command
240line interface. You will need to echo or print the output of this
241function. Sample output for mysql:</p>
242<pre>-- Ratios -- <br>          MyISAM cache hit ratio =&gt; 56.5635738832 <br>          InnoDB cache hit ratio =&gt; 0 <br>             sql cache hit ratio =&gt; 0 <br> -- IO -- <br>                      data reads =&gt; 2622 <br>                     data writes =&gt; 2415.5 <br> -- Data Cache -- <br>          MyISAM data cache size =&gt; 512K <br>             BDB data cache size =&gt; 8388600<br>          InnoDB data cache size =&gt; 8M<br> -- Memory Pools -- <br>                read buffer size =&gt; 131072 <br>                sort buffer size =&gt; 65528 <br>                     table cache =&gt; 4 <br> -- Connections -- <br>             current connections =&gt; 3<br>                 max connections =&gt; 100</pre>
243<p><font face="Courier New, Courier, mono">function <b>Poll</b>($pollSecs=5)
244</font> </p>
245<p> Run in infinite loop, displaying the following information every
246$pollSecs. This will not work properly if output buffering is enabled.
247In the example below, $pollSecs=3:
248</p>
249<pre>Accumulating statistics...<br> Time   WS-CPU%   Hit%   Sess        Reads/s          Writes/s<br>11:08:30    0.7  56.56      1         0.0000            0.0000<br>11:08:33    1.8  56.56      2         0.0000            0.0000<br>11:08:36   11.1  56.55      3         2.5000            0.0000<br>11:08:39    9.8  56.55      2         3.1121            0.0000<br>11:08:42    2.8  56.55      1         0.0000            0.0000<br>11:08:45    7.4  56.55      2         0.0000            1.5000<br></pre>
250<p><b>WS-CPU%</b> is the Web Server CPU load of the server that PHP is
251running from (eg. the database client), and not the database. The <b>Hit%</b>
252is the data cache hit ratio. <b>Sess</b> is the current number of
253sessions connected to the database. If you are using persistent
254connections, this should not change much. The <b>Reads/s</b> and <b>Writes/s</b>
255are synthetic values to give the viewer a rough guide to I/O, and are
256not to be taken literally. </p>
257<p><font face="Courier New, Courier, mono">function <b>SuspiciousSQL</b>($numsql=10)</font></p>
258<p>Returns SQL which have high average execution times as a HTML table.
259Each sql statement
260is hyperlinked to a new window which details the execution plan and the
261scripts that execute this SQL.
262</p>
263<p> The number of statements returned is determined by $numsql. Data is
264taken from the adodb_logsql table, where the sql statements are logged
265when
266$connection-&gt;LogSQL(true) is enabled. The adodb_logsql table is
267populated using <a href="docs-adodb.htm#logsql">$conn-&gt;LogSQL</a>.
268</p>
269<p>For Oracle, Ixora Suspicious SQL returns a list of SQL statements
270that are most cache intensive as a HTML table. These are data intensive
271SQL statements that could benefit most from tuning. </p>
272<p><font face="Courier New, Courier, mono">function <b>ExpensiveSQL</b>($numsql=10)</font></p>
273<p>Returns SQL whose total execution time (avg time * #executions) is
274high as a HTML table. Each sql statement
275is hyperlinked to a new window which details the execution plan and the
276scripts that execute this SQL.
277</p>
278<p> The number of statements returned is determined by $numsql. Data is
279taken from the adodb_logsql table, where the sql statements are logged
280when
281$connection-&gt;LogSQL(true) is enabled. The adodb_logsql table is
282populated using <a href="docs-adodb.htm#logsql">$conn-&gt;LogSQL</a>.
283</p>
284<p>For Oracle, Ixora Expensive SQL returns a list of SQL statements
285that are taking the most CPU load when run.
286</p>
287<p><font face="Courier New, Courier, mono">function <b>InvalidSQL</b>($numsql=10)</font></p>
288<p>Returns a list of invalid SQL as an HTML table.
289</p>
290<p>Data is taken from the adodb_logsql table, where the sql statements
291are logged when
292$connection-&gt;LogSQL(true) is enabled.
293</p>
294<p><font face="Courier New, Courier, mono">function <b>Tables</b>($orderby=1)</font></p>
295<p>Returns information on all tables in a database, with the first two
296fields containing the table name and table size, the remaining fields
297depend on the database driver. If $orderby is set to 1, it will sort by
298name. If $orderby is set to 2, then it will sort by table size. Some
299database drivers (mssql and mysql) will ignore the $orderby clause. For
300postgresql, the information is up-to-date since the last <i>vacuum</i>.
301Not supported currently for db2.</p>
302<h3>Raw Functions</h3>
303<p>Raw functions return values without any formatting.</p>
304<p><font face="Courier New, Courier, mono">function <b>DBParameter</b>($paramname)</font></p>
305<p>Returns the value of a database parameter, such as
306$this-&gt;DBParameter("data cache size").</p>
307<p><font face="Courier New, Courier, mono">function <b>CPULoad</b>()</font></p>
308<p>Returns the CPU load of the database client (NOT THE SERVER) as a
309percentage. Only works for Linux and Windows. For Windows, WMI must be
310available.</p>
311<h3>Format of $settings Property</h3>
312<p> To create new database parameters, you need to understand
313$settings. The $settings data structure is an associative array. Each
314element of the array defines a database parameter. The key is the name
315of the database parameter. If no key is defined, then it is assumed to
316be a section break, and the value is the name of the section break. If
317this is too confusing, looking at the source code will help a lot!</p>
318<p> Each database parameter is itself an array consisting of the
319following elements:</p>
320<ol start="0">
321  <li> Category code, used to group related db parameters. If the
322category code is 'HIDE', then
323the database parameter is not shown when HTML() is called. <br>
324  </li>
325  <li> either
326    <ol type="a">
327      <li>sql string to retrieve value, eg. "select value from
328v\$parameter where name='db_block_size'", </li>
329      <li>array holding sql string and field to look for, e.g.
330array('show variables','table_cache'); optional 3rd parameter is the
331$rs-&gt;fields[$index] to use (otherwise $index=1), and optional 4th
332parameter is a constant to multiply the result with (typically 100 for
333percentage calculations),</li>
334      <li>a string prefixed by =, then a PHP method of the class is
335invoked, e.g. to invoke $this-&gt;GetIndexValue(), set this array
336element to '=GetIndexValue', <br>
337      </li>
338    </ol>
339  </li>
340  <li> Description of database parameter. If description begins with an
341=, then it is interpreted as a method call, just as in (1c) above,
342taking one parameter, the current value. E.g. '=GetIndexDescription'
343will invoke $this-&gt;GetIndexDescription($val). This is useful for
344generating tuning suggestions. For an example, see WarnCacheRatio().</li>
345</ol>
346<p>Example from MySQL, table_cache database parameter:</p>
347<pre>'table cache' =&gt; array('CACHE', # category code<br>   array("show variables", 'table_cache'), # array (type 1b)<br>   'Number of tables to keep open'),       # description</pre>
348<h3>Example Health Check Output</h3>
349<p><a href="#db2">db2</a> <a href="#informix">informix</a> <a
350 href="#mysql">mysql</a> <a href="#mssql">mssql</a> <a href="#oci8">oci8</a>
351<a href="#postgres">postgres</a></p>
352<p><a name="db2"></a></p>
353<table bgcolor="white" border="1">
354  <tbody>
355    <tr>
356      <td colspan="3">
357      <h3>db2</h3>
358      </td>
359    </tr>
360    <tr>
361      <td><b>Parameter</b></td>
362      <td><b>Value</b></td>
363      <td><b>Description</b></td>
364    </tr>
365    <tr bgcolor="#f0f0f0">
366      <td colspan="3"><i>Ratios</i> &nbsp;</td>
367    </tr>
368    <tr bgcolor="#ffffff">
369      <td>data cache hit ratio</td>
370      <td>0 &nbsp; </td>
371      <td>&nbsp;</td>
372    </tr>
373    <tr bgcolor="#f0f0f0">
374      <td colspan="3"><i>Data Cache</i></td>
375    </tr>
376    <tr bgcolor="#ffffff">
377      <td>data cache buffers</td>
378      <td>250 &nbsp; </td>
379      <td>See <a
380 href="http://www7b.boulder.ibm.com/dmdd/library/techarticle/anshum/0107anshum.html#bufferpoolsize">tuning
381reference</a>.</td>
382    </tr>
383    <tr bgcolor="#ffffff">
384      <td>cache blocksize</td>
385      <td>4096 &nbsp; </td>
386      <td>&nbsp;</td>
387    </tr>
388    <tr bgcolor="#ffffff">
389      <td>data cache size</td>
390      <td>1000K &nbsp; </td>
391      <td>&nbsp;</td>
392    </tr>
393    <tr bgcolor="#f0f0f0">
394      <td colspan="3"><i>Connections</i></td>
395    </tr>
396    <tr bgcolor="#ffffff">
397      <td>current connections</td>
398      <td>2 &nbsp; </td>
399      <td>&nbsp;</td>
400    </tr>
401  </tbody>
402</table>
403<p>&nbsp;</p>
404<p><a name="informix"></a>
405<table bgcolor="white" border="1">
406  <tbody>
407    <tr>
408      <td colspan="3">
409      <h3>informix</h3>
410      </td>
411    </tr>
412    <tr>
413      <td><b>Parameter</b></td>
414      <td><b>Val
415ue</b></td>
416      <td><b>Description</b></td>
417    </tr>
418    <tr bgcolor="#f0f0f0">
419      <td colspan="3"><i>Ratios</i> &nbsp;</td>
420    </tr>
421    <tr>
422      <td>data cache hit
423ratio</td>
424      <td>95.89</td>
425      <td>&nbsp;</td>
426    </tr>
427    <tr bgcolor="#f0f0f0">
428      <td colspan="3"><i>IO</i> &nbsp;</td>
429    </tr>
430    <tr>
431      <td>data
432reads</td>
433      <td>1883884</td>
434      <td>Page reads</td>
435    </tr>
436    <tr>
437      <td>data writes</td>
438      <td>1716724</td>
439      <td>Page writes</td>
440    </tr>
441    <tr bgcolor="#f0f0f0">
442      <td colspan="3"><i>Connections</i>
443&nbsp;</td>
444    </tr>
445    <tr>
446      <td>current connections</td>
447      <td>263.0</td>
448      <td>Number of
449sessions</td>
450    </tr>
451  </tbody>
452</table>
453</p>
454<p>&nbsp;</p>
455<p><a name="mysql" id="mysql"></a></p>
456<table bgcolor="white" border="1">
457  <tbody>
458    <tr>
459      <td colspan="3">
460      <h3>mysql</h3>
461      </td>
462    </tr>
463    <tr>
464      <td><b>Parameter</b></td>
465      <td><b>Value</b></td>
466      <td><b>Description</b></td>
467    </tr>
468    <tr bgcolor="#f0f0f0">
469      <td colspan="3"><i>Ratios</i> &nbsp;</td>
470    </tr>
471    <tr>
472      <td>MyISAM cache hit ratio</td>
473      <td>56.5658301822</td>
474      <td><font color="red"><b>Cache ratio should be at least 90%</b></font></td>
475    </tr>
476    <tr>
477      <td>InnoDB cache hit ratio</td>
478      <td>0</td>
479      <td><font color="red"><b>Cache ratio should be at least 90%</b></font></td>
480    </tr>
481    <tr>
482      <td>sql cache hit ratio</td>
483      <td>0</td>
484      <td>&nbsp;</td>
485    </tr>
486    <tr bgcolor="#f0f0f0">
487      <td colspan="3"><i>IO</i> &nbsp;</td>
488    </tr>
489    <tr>
490      <td>data reads</td>
491      <td>2622</td>
492      <td>Number of selects (Key_reads is not accurate)</td>
493    </tr>
494    <tr>
495      <td>data writes</td>
496      <td>2415.5</td>
497      <td>Number of inserts/updates/deletes * coef (Key_writes is not
498accurate)</td>
499    </tr>
500    <tr bgcolor="#f0f0f0">
501      <td colspan="3"><i>Data Cache</i> &nbsp;</td>
502    </tr>
503    <tr>
504      <td>MyISAM data cache size</td>
505      <td>512K</td>
506      <td>&nbsp;</td>
507    </tr>
508    <tr>
509      <td>BDB data cache size</td>
510      <td>8388600</td>
511      <td>&nbsp;</td>
512    </tr>
513    <tr>
514      <td>InnoDB data cache size</td>
515      <td>8M</td>
516      <td>&nbsp;</td>
517    </tr>
518    <tr bgcolor="#f0f0f0">
519      <td colspan="3"><i>Memory Pools</i> &nbsp;</td>
520    </tr>
521    <tr>
522      <td>read buffer size</td>
523      <td>131072</td>
524      <td>(per session)</td>
525    </tr>
526    <tr>
527      <td>sort buffer size</td>
528      <td>65528</td>
529      <td>Size of sort buffer (per session)</td>
530    </tr>
531    <tr>
532      <td>table cache</td>
533      <td>4</td>
534      <td>Number of tables to keep open</td>
535    </tr>
536    <tr bgcolor="#f0f0f0">
537      <td colspan="3"><i>Connections</i> &nbsp;</td>
538    </tr>
539    <tr>
540      <td>current connections</td>
541      <td>3</td>
542      <td>&nbsp;</td>
543    </tr>
544    <tr>
545      <td>max connections</td>
546      <td>100</td>
547      <td>&nbsp;</td>
548    </tr>
549  </tbody>
550</table>
551<p>&nbsp;</p>
552<p><a name="mssql" id="mssql"></a></p>
553<table bgcolor="white" border="1">
554  <tbody>
555    <tr>
556      <td colspan="3">
557      <h3>mssql</h3>
558      </td>
559    </tr>
560    <tr>
561      <td><b>Parameter</b></td>
562      <td><b>Value</b></td>
563      <td><b>Description</b></td>
564    </tr>
565    <tr bgcolor="#f0f0f0">
566      <td colspan="3"><i>Ratios</i> &nbsp;</td>
567    </tr>
568    <tr>
569      <td>data cache hit ratio</td>
570      <td>99.9999694824</td>
571      <td>&nbsp;</td>
572    </tr>
573    <tr>
574      <td>prepared sql hit ratio</td>
575      <td>99.7738579828</td>
576      <td>&nbsp;</td>
577    </tr>
578    <tr>
579      <td>adhoc sql hit ratio</td>
580      <td>98.4540169133</td>
581      <td>&nbsp;</td>
582    </tr>
583    <tr bgcolor="#f0f0f0">
584      <td colspan="3"><i>IO</i> &nbsp;</td>
585    </tr>
586    <tr>
587      <td>data reads</td>
588      <td>2858</td>
589      <td>&nbsp; </td>
590    </tr>
591    <tr>
592      <td>data writes</td>
593      <td>1438</td>
594      <td>&nbsp; </td>
595    </tr>
596    <tr bgcolor="#f0f0f0">
597      <td colspan="3"><i>Data Cache</i> &nbsp;</td>
598    </tr>
599    <tr>
600      <td>data cache size</td>
601      <td>4362</td>
602      <td>in K</td>
603    </tr>
604    <tr bgcolor="#f0f0f0">
605      <td colspan="3"><i>Connections</i> &nbsp;</td>
606    </tr>
607    <tr>
608      <td>current connections</td>
609      <td>14</td>
610      <td>&nbsp;</td>
611    </tr>
612    <tr>
613      <td>max connections</td>
614      <td>32767</td>
615      <td>&nbsp;</td>
616    </tr>
617  </tbody>
618</table>
619<p>&nbsp;</p>
620<p><a name="oci8" id="oci8"></a></p>
621<table bgcolor="white" border="1">
622  <tbody>
623    <tr>
624      <td colspan="3">
625      <h3>oci8</h3>
626      </td>
627    </tr>
628    <tr>
629      <td><b>Parameter</b></td>
630      <td><b>Value</b></td>
631      <td><b>Description</b></td>
632    </tr>
633    <tr bgcolor="#f0f0f0">
634      <td colspan="3"><i>Ratios</i> &nbsp;</td>
635    </tr>
636    <tr>
637      <td>data cache hit ratio</td>
638      <td>96.98</td>
639      <td>&nbsp;</td>
640    </tr>
641    <tr>
642      <td>sql cache hit ratio</td>
643      <td>99.96</td>
644      <td>&nbsp;</td>
645    </tr>
646    <tr bgcolor="#f0f0f0">
647      <td colspan="3"><i>IO</i> &nbsp;</td>
648    </tr>
649    <tr>
650      <td>data reads</td>
651      <td>842938</td>
652      <td>&nbsp; </td>
653    </tr>
654    <tr>
655      <td>data writes</td>
656      <td>16852</td>
657      <td>&nbsp; </td>
658    </tr>
659    <tr bgcolor="#f0f0f0">
660      <td colspan="3"><i>Data Cache</i> &nbsp;</td>
661    </tr>
662    <tr>
663      <td>data cache buffers</td>
664      <td>3072</td>
665      <td>Number of cache buffers</td>
666    </tr>
667    <tr>
668      <td>data cache blocksize</td>
669      <td>8192</td>
670      <td>&nbsp;</td>
671    </tr>
672    <tr>
673      <td>data cache size</td>
674      <td>48M</td>
675      <td>shared_pool_size</td>
676    </tr>
677    <tr bgcolor="#f0f0f0">
678      <td colspan="3"><i>Memory Pools</i> &nbsp;</td>
679    </tr>
680    <tr>
681      <td>java pool size</td>
682      <td>0</td>
683      <td>java_pool_size</td>
684    </tr>
685    <tr>
686      <td>sort buffer size</td>
687      <td>512K</td>
688      <td>sort_area_size (per query)</td>
689    </tr>
690    <tr>
691      <td>user session buffer size</td>
692      <td>8M</td>
693      <td>large_pool_size</td>
694    </tr>
695    <tr bgcolor="#f0f0f0">
696      <td colspan="3"><i>Connections</i> &nbsp;</td>
697    </tr>
698    <tr>
699      <td>current connections</td>
700      <td>1</td>
701      <td>&nbsp;</td>
702    </tr>
703    <tr>
704      <td>max connections</td>
705      <td>170</td>
706      <td>&nbsp;</td>
707    </tr>
708    <tr>
709      <td>data cache utilization ratio</td>
710      <td>88.46</td>
711      <td>Percentage of data cache actually in use</td>
712    </tr>
713    <tr>
714      <td>user cache utilization ratio</td>
715      <td>91.76</td>
716      <td>Percentage of user cache (large_pool) actually in use</td>
717    </tr>
718    <tr>
719      <td>rollback segments</td>
720      <td>11</td>
721      <td>&nbsp;</td>
722    </tr>
723    <tr bgcolor="#f0f0f0">
724      <td colspan="3"><i>Transactions</i> &nbsp;</td>
725    </tr>
726    <tr>
727      <td>peak transactions</td>
728      <td>24</td>
729      <td>Taken from high-water-mark</td>
730    </tr>
731    <tr>
732      <td>max transactions</td>
733      <td>187</td>
734      <td>max transactions / rollback segments &lt; 3.5 (or
735transactions_per_rollback_segment)</td>
736    </tr>
737    <tr bgcolor="#f0f0f0">
738      <td colspan="3"><i>Parameters</i> &nbsp;</td>
739    </tr>
740    <tr>
741      <td>cursor sharing</td>
742      <td>EXACT</td>
743      <td>Cursor reuse strategy. Recommended is FORCE (8i+) or SIMILAR
744(9i+). See <a
745 href="http://www.praetoriate.com/oracle_tips_cursor_sharing.htm">cursor_sharing</a>.</td>
746    </tr>
747    <tr>
748      <td>index cache cost</td>
749      <td>0</td>
750      <td>% of indexed data blocks expected in the cache. Recommended
751is 20-80. Default is 0. See <a
752 href="http://www.dba-oracle.com/oracle_tips_cbo_part1.htm">optimizer_index_caching</a>.</td>
753    </tr>
754    <tr>
755      <td>random page cost</td>
756      <td>100</td>
757      <td>Recommended is 10-50 for TP, and 50 for data warehouses.
758Default is 100. See <a
759 href="http://www.dba-oracle.com/oracle_tips_cost_adj.htm">optimizer_index_cost_adj</a>.
760      </td>
761    </tr>
762  </tbody>
763</table>
764<h3>Suspicious SQL</h3>
765<table bgcolor="white" border="1">
766  <tbody>
767    <tr>
768      <td><b>LOAD</b></td>
769      <td><b>EXECUTES</b></td>
770      <td><b>SQL_TEXT</b></td>
771    </tr>
772    <tr>
773      <td align="right"> .73%</td>
774      <td align="right">89</td>
775      <td>select u.name, o.name, t.spare1, t.pctfree$ from sys.obj$ o,
776sys.user$ u, sys.tab$ t where (bitand(t.trigflag, 1048576) = 1048576)
777and o.obj#=t.obj# and o.owner# = u.user# select i.obj#, i.flags,
778u.name, o.name from sys.obj$ o, sys.user$ u, sys.ind$ i where
779(bitand(i.flags, 256) = 256 or bitand(i.flags, 512) = 512) and
780(not((i.type# = 9) and bitand(i.flags,8) = 8)) and o.obj#=i.obj# and
781o.owner# = u.user# </td>
782    </tr>
783    <tr>
784      <td align="right"> .84%</td>
785      <td align="right">3</td>
786      <td>select /*+ RULE */ distinct tabs.table_name, tabs.owner ,
787partitioned, iot_type , TEMPORARY, table_type, table_type_owner from
788DBA_ALL_TABLES tabs where tabs.owner = :own </td>
789    </tr>
790    <tr>
791      <td align="right"> 3.95%</td>
792      <td align="right">6</td>
793      <td>SELECT round(count(1)*avg(buf.block_size)/1048576) FROM
794DBA_OBJECTS obj, V$BH bh, dba_segments seg, v$buffer_pool buf WHERE
795obj.object_id = bh.objd AND obj.owner != 'SYS' and obj.owner =
796seg.owner and obj.object_name = seg.segment_name and obj.object_type =
797seg.segment_type and seg.buffer_pool = buf.name and buf.name =
798'DEFAULT' </td>
799    </tr>
800    <tr>
801      <td align="right"> 4.50%</td>
802      <td align="right">6</td>
803      <td>SELECT round(count(1)*avg(tsp.block_size)/1048576) FROM
804DBA_OBJECTS obj, V$BH bh, dba_segments seg, dba_tablespaces tsp WHERE
805obj.object_id = bh.objd AND obj.owner != 'SYS' and obj.owner =
806seg.owner and obj.object_name = seg.segment_name and obj.object_type =
807seg.segment_type and seg.tablespace_name = tsp.tablespace_name </td>
808    </tr>
809    <tr>
810      <td align="right">57.34%</td>
811      <td align="right">9267</td>
812      <td>select t.schema, t.name, t.flags, q.name from
813system.aq$_queue_tables t, sys.aq$_queue_table_affinities aft,
814system.aq$_queues q where aft.table_objno = t.objno and
815aft.owner_instance = :1 and q.table_objno = t.objno and q.usage = 0 and
816bitand(t.flags, 4+16+32+64+128+256) = 0 for update of t.name,
817aft.table_objno skip locked </td>
818    </tr>
819  </tbody>
820</table>
821<h3>Expensive SQL</h3>
822<table bgcolor="white" border="1">
823  <tbody>
824    <tr>
825      <td><b>LOAD</b></td>
826      <td><b>EXECUTES</b></td>
827      <td><b>SQL_TEXT</b></td>
828    </tr>
829    <tr>
830      <td align="right"> 5.24%</td>
831      <td align="right">1</td>
832      <td>select round(sum(bytes)/1048576) from dba_segments </td>
833    </tr>
834    <tr>
835      <td align="right"> 6.89%</td>
836      <td align="right">6</td>
837      <td>SELECT round(count(1)*avg(buf.block_size)/1048576) FROM
838DBA_OBJECTS obj, V$BH bh, dba_segments seg, v$buffer_pool buf WHERE
839obj.object_id = bh.objd AND obj.owner != 'SYS' and obj.owner =
840seg.owner and obj.object_name = seg.segment_name and obj.object_type =
841seg.segment_type and seg.buffer_pool = buf.name and buf.name =
842'DEFAULT' </td>
843    </tr>
844    <tr>
845      <td align="right"> 7.85%</td>
846      <td align="right">6</td>
847      <td>SELECT round(count(1)*avg(tsp.block_size)/1048576) FROM
848DBA_OBJECTS obj, V$BH bh, dba_segments seg, dba_tablespaces tsp WHERE
849obj.object_id = bh.objd AND obj.owner != 'SYS' and obj.owner =
850seg.owner and obj.object_name = seg.segment_name and obj.object_type =
851seg.segment_type and seg.tablespace_name = tsp.tablespace_name </td>
852    </tr>
853    <tr>
854      <td align="right">33.69%</td>
855      <td align="right">89</td>
856      <td>select u.name, o.name, t.spare1, t.pctfree$ from sys.obj$ o,
857sys.user$ u, sys.tab$ t where (bitand(t.trigflag, 1048576) = 1048576)
858and o.obj#=t.obj# and o.owner# = u.user# </td>
859    </tr>
860    <tr>
861      <td align="right">36.44%</td>
862      <td align="right">89</td>
863      <td>select i.obj#, i.flags, u.name, o.name from sys.obj$ o,
864sys.user$ u, sys.ind$ i where (bitand(i.flags, 256) = 256 or
865bitand(i.flags, 512) = 512) and (not((i.type# = 9) and
866bitand(i.flags,8) = 8)) and o.obj#=i.obj# and o.owner# = u.user# </td>
867    </tr>
868  </tbody>
869</table>
870<p><a name="postgres" id="postgres"></a></p>
871<table bgcolor="white" border="1">
872  <tbody>
873    <tr>
874      <td colspan="3">
875      <h3>postgres7</h3>
876      </td>
877    </tr>
878    <tr>
879      <td><b>Parameter</b></td>
880      <td><b>Value</b></td>
881      <td><b>Description</b></td>
882    </tr>
883    <tr bgcolor="#f0f0f0">
884      <td colspan="3"><i>Ratios</i> &nbsp;</td>
885    </tr>
886    <tr>
887      <td>statistics collector</td>
888      <td>FALSE</td>
889      <td>Must be set to TRUE to enable hit ratio statistics (<i>stats_start_collector</i>,<i>stats_row_level</i>
890and <i>stats_block_level</i> must be set to true in postgresql.conf)</td>
891    </tr>
892    <tr>
893      <td>data cache hit ratio</td>
894      <td>99.9666031916603</td>
895      <td>&nbsp;</td>
896    </tr>
897    <tr bgcolor="#f0f0f0">
898      <td colspan="3"><i>IO</i> &nbsp;</td>
899    </tr>
900    <tr>
901      <td>data reads</td>
902      <td>15</td>
903      <td>&nbsp; </td>
904    </tr>
905    <tr>
906      <td>data writes</td>
907      <td>0.000000000000000000</td>
908      <td>Count of inserts/updates/deletes * coef</td>
909    </tr>
910    <tr bgcolor="#f0f0f0">
911      <td colspan="3"><i>Data Cache</i> &nbsp;</td>
912    </tr>
913    <tr>
914      <td>data cache buffers</td>
915      <td>1280</td>
916      <td>Number of cache buffers. <a
917 href="http://www.varlena.com/GeneralBits/Tidbits/perf.html#basic">Tuning</a></td>
918    </tr>
919    <tr>
920      <td>cache blocksize</td>
921      <td>8192</td>
922      <td>(estimate)</td>
923    </tr>
924    <tr>
925      <td>data cache size</td>
926      <td>10M</td>
927      <td>&nbsp;</td>
928    </tr>
929    <tr>
930      <td>operating system cache size</td>
931      <td>80000K</td>
932      <td>(effective cache size)</td>
933    </tr>
934    <tr bgcolor="#f0f0f0">
935      <td colspan="3"><i>Memory Pools</i> &nbsp;</td>
936    </tr>
937    <tr>
938      <td>sort buffer size</td>
939      <td>1M</td>
940      <td>Size of sort buffer (per query)</td>
941    </tr>
942    <tr bgcolor="#f0f0f0">
943      <td colspan="3"><i>Connections</i> &nbsp;</td>
944    </tr>
945    <tr>
946      <td>current connections</td>
947      <td>13</td>
948      <td>&nbsp;</td>
949    </tr>
950    <tr>
951      <td>max connections</td>
952      <td>32</td>
953      <td>&nbsp;</td>
954    </tr>
955    <tr bgcolor="#f0f0f0">
956      <td colspan="3"><i>Parameters</i> &nbsp;</td>
957    </tr>
958    <tr>
959      <td>rollback buffers</td>
960      <td>8</td>
961      <td>WAL buffers</td>
962    </tr>
963    <tr>
964      <td>random page cost</td>
965      <td>4</td>
966      <td>Cost of doing a seek (default=4). See <a
967 href="http://www.varlena.com/GeneralBits/Tidbits/perf.html#less">random_page_cost</a></td>
968    </tr>
969  </tbody>
970</table>
971</body>
972</html>
Note: See TracBrowser for help on using the repository browser.