File: docs-perf.htm

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