Source for file perf-db2.inc.php
Documentation is available at perf-db2.inc.php
V4.97 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
Set tabs to 4 for best viewing.
Latest version is available at http://adodb.sourceforge.net
Library for basic performance monitoring and tuning
// Simple guide to configuring db2: so-so http://www.devx.com/gethelpon/10MinuteSolution/16575
// SELECT * FROM TABLE(SNAPSHOT_APPL('SAMPLE', -1)) as t
created TIMESTAMP NOT NULL,
sql0 varchar(250) NOT NULL,
sql1 varchar(4000) NOT NULL,
params varchar(3000) NOT NULL,
tracer varchar(500) NOT NULL,
timer decimal(16,6) NOT NULL
'data cache hit ratio' => array('RATIO',
case when sum(POOL_DATA_L_READS+POOL_INDEX_L_READS)=0 then 0
else 100*(1-sum(POOL_DATA_P_READS+POOL_INDEX_P_READS)/sum(POOL_DATA_L_READS+POOL_INDEX_L_READS)) end
FROM TABLE(SNAPSHOT_APPL('',-2)) as t",
'data cache buffers' => array('DATAC',
'select sum(npages) from SYSCAT.BUFFERPOOLS',
'See <a href=http://www7b.boulder.ibm.com/dmdd/library/techarticle/anshum/0107anshum.html#bufferpoolsize>tuning reference</a>.' ),
'cache blocksize' => array('DATAC',
'select avg(pagesize) from SYSCAT.BUFFERPOOLS',
'data cache size' => array('DATAC',
'select sum(npages*pagesize) from SYSCAT.BUFFERPOOLS',
'current connections' => array('SESS',
"SELECT count(*) FROM TABLE(SNAPSHOT_APPL_INFO('',-2)) as t",
function Explain($sql,$partial= false)
$save = $this->conn->LogSQL(false);
$sqlq = $this->conn->qstr($sql. '%');
$arr = $this->conn->GetArray("select distinct sql1 from adodb_logsql where sql1 like $sqlq");
if (crc32($sql) == $partial) break;
$ok = $this->conn->Execute("EXPLAIN PLAN SET QUERYNO=$qno FOR $sql");
if (!$ok) echo "<p>Have EXPLAIN tables been created?</p>";
$rs = $this->conn->Execute("select * from explain_statement where queryno=$qno");
$this->conn->LogSQL($save);
$rs = $this->conn->Execute("select tabschema,tabname,card as rows,
npages pages_used,fpages pages_allocated, tbspace tablespace
from syscat.tables where tabschema not in ('SYSCAT','SYSIBM','SYSSTAT') order by 1,2");
return rs2html($rs,false,false,false,false);
|