docs-perf.htm 31 KB

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