Changeset 8222 for sandbox/2.5.1-evolucao/phpgwapi/inc/adodb/perf
- Timestamp:
- 09/26/13 15:41:49 (11 years ago)
- Location:
- sandbox/2.5.1-evolucao/phpgwapi/inc/adodb/perf
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.5.1-evolucao/phpgwapi/inc/adodb/perf/perf-db2.inc.php
r34 r8222 1 1 <?php 2 2 /* 3 V 4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.3 V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved. 4 4 Released under both BSD license and Lesser GPL library license. 5 5 Whenever there is any discrepancy between the two licenses, … … 59 59 function perf_db2(&$conn) 60 60 { 61 $this->conn = &$conn;61 $this->conn = $conn; 62 62 } 63 63 -
sandbox/2.5.1-evolucao/phpgwapi/inc/adodb/perf/perf-informix.inc.php
r34 r8222 1 1 <?php 2 2 /* 3 V 4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.3 V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved. 4 4 Released under both BSD license and Lesser GPL library license. 5 5 Whenever there is any discrepancy between the two licenses, … … 64 64 function perf_informix(&$conn) 65 65 { 66 $this->conn = &$conn;66 $this->conn = $conn; 67 67 } 68 68 -
sandbox/2.5.1-evolucao/phpgwapi/inc/adodb/perf/perf-mssql.inc.php
r34 r8222 2 2 3 3 /* 4 V 4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.4 V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved. 5 5 Released under both BSD license and Lesser GPL library license. 6 6 Whenever there is any discrepancy between the two licenses, … … 72 72 //$this->explain = false; 73 73 } 74 $this->conn = &$conn;74 $this->conn = $conn; 75 75 } 76 76 … … 97 97 $save = $ADODB_FETCH_MODE; 98 98 $ADODB_FETCH_MODE = ADODB_FETCH_NUM; 99 $rs = &$this->conn->Execute($sql);99 $rs = $this->conn->Execute($sql); 100 100 //adodb_printr($rs); 101 101 $ADODB_FETCH_MODE = $save; 102 if ($rs ) {102 if ($rs && !$rs->EOF) { 103 103 $rs->MoveNext(); 104 104 $s .= '<table bgcolor=white border=0 cellpadding="1" callspacing=0><tr><td nowrap align=center> Rows<td nowrap align=center> IO<td nowrap align=center> CPU<td align=left> Plan</tr>'; -
sandbox/2.5.1-evolucao/phpgwapi/inc/adodb/perf/perf-mysql.inc.php
r34 r8222 1 1 <?php 2 2 /* 3 V 4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.3 V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved. 4 4 Released under both BSD license and Lesser GPL library license. 5 5 Whenever there is any discrepancy between the two licenses, … … 84 84 function perf_mysql(&$conn) 85 85 { 86 $this->conn = &$conn;86 $this->conn = $conn; 87 87 } 88 88 … … 252 252 if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false); 253 253 254 $rs = $this->conn->Execute('show innodb status');254 $rs = $this->conn->Execute('show engine innodb status'); 255 255 256 256 if (isset($savem)) $this->conn->SetFetchMode($savem); -
sandbox/2.5.1-evolucao/phpgwapi/inc/adodb/perf/perf-oci8.inc.php
r34 r8222 1 1 <?php 2 2 /* 3 V 4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.3 V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved. 4 4 Released under both BSD license and Lesser GPL library license. 5 5 Whenever there is any discrepancy between the two licenses, … … 16 16 if (!defined('ADODB_DIR')) die(); 17 17 18 18 19 class perf_oci8 extends ADODB_perf{ 20 21 var $noShowIxora = 15; // if the sql for suspicious sql is taking too long, then disable ixora 19 22 20 23 var $tablesSQL = "select segment_name as \"tablename\", sum(bytes)/1024 as \"size_in_k\",tablespace_name as \"tablespace\",count(*) \"extents\" from sys.user_extents … … 22 25 23 26 var $version; 27 24 28 var $createTableSQL = "CREATE TABLE adodb_logsql ( 25 29 created date NOT NULL, … … 69 73 70 74 'Data Cache', 75 71 76 'data cache buffers' => array( 'DATAC', 72 77 "select a.value/b.value from v\$parameter a, v\$parameter b … … 76 81 "select value from v\$parameter where name='db_block_size'", 77 82 '' ), 83 78 84 'Memory Pools', 79 'data cache size' => array('DATAC', 85 'Mem Max Target (11g+)' => array( 'DATAC', 86 "select value from v\$parameter where name = 'memory_max_target'", 87 'The memory_max_size is the maximum value to which memory_target can be set.' ), 88 'Memory target (11g+)' => array( 'DATAC', 89 "select value from v\$parameter where name = 'memory_target'", 90 'If memory_target is defined then SGA and PGA targets are consolidated into one memory_target.' ), 91 'SGA Max Size' => array( 'DATAC', 92 "select nvl(value,0)/1024.0/1024 || 'M' from v\$parameter where name = 'sga_max_size'", 93 'The sga_max_size is the maximum value to which sga_target can be set.' ), 94 'SGA target' => array( 'DATAC', 95 "select nvl(value,0)/1024.0/1024 || 'M' from v\$parameter where name = 'sga_target'", 96 'If sga_target is defined then data cache, shared, java and large pool size can be 0. This is because all these pools are consolidated into one sga_target.' ), 97 'PGA aggr target' => array( 'DATAC', 98 "select nvl(value,0)/1024.0/1024 || 'M' from v\$parameter where name = 'pga_aggregate_target'", 99 'If pga_aggregate_target is defined then this is the maximum memory that can be allocated for cursor operations such as sorts, group by, joins, merges. When in doubt, set it to 20% of sga_target.' ), 100 'data cache size' => array('DATAC', 80 101 "select value from v\$parameter where name = 'db_cache_size'", 81 102 'db_cache_size' ), … … 90 111 'this pool is for large mem allocations (not because it is larger than shared pool), for MTS sessions, parallel queries, io buffers (large_pool_size) ' ), 91 112 92 'pga buffer size' => array('CACHE', 93 "select value from v\$parameter where name='pga_aggregate_target'", 94 'program global area is private memory for sorting, and hash and bitmap merges - since oracle 9i (pga_aggregate_target)' ), 95 113 'dynamic memory usage' => array('CACHE', "select '-' from dual", '=DynMemoryUsage'), 96 114 97 115 'Connections', … … 110 128 'Percentage of data cache actually in use - should be over 85%'), 111 129 112 130 'shared pool utilization ratio' => array('RATIOU', 113 131 'select round((sga.bytes/case when p.value=0 then sga.bytes else to_number(p.value) end)*100,2) 114 132 from v$sgastat sga, v$parameter p … … 126 144 'max in-mem sort_area_size (per query), uses memory in pga' ), 127 145 128 'pga usage at peak' => array('RATIOU',129 '=PGA','Mb utilization at peak transactions (requires Oracle 9i+)'), 146 /*'pga usage at peak' => array('RATIOU', 147 '=PGA','Mb utilization at peak transactions (requires Oracle 9i+)'),*/ 130 148 'Transactions', 131 149 'rollback segments' => array('ROLLBACK', … … 157 175 "select value from v\$parameter where name = 'optimizer_index_cost_adj'", 158 176 '=WarnPageCost'), 159 177 'Waits', 178 'Recent wait events' => array('WAITS','select \'Top 5 events\' from dual','=TopRecentWaits'), 179 // 'Historical wait SQL' => array('WAITS','select \'Last 2 days\' from dual','=TopHistoricalWaits'), -- requires AWR license 180 'Backup', 181 'Achivelog Mode' => array('BACKUP', 'select log_mode from v$database', '=LogMode'), 182 183 'DBID' => array('BACKUP','select dbid from v$database','Primary key of database, used for recovery with an RMAN Recovery Catalog'), 184 'Archive Log Dest' => array('BACKUP', "SELECT NVL(v1.value,v2.value) 185 FROM v\$parameter v1, v\$parameter v2 WHERE v1.name='log_archive_dest' AND v2.name='log_archive_dest_10'", ''), 186 187 'Flashback Area' => array('BACKUP', "select nvl(value,'Flashback Area not used') from v\$parameter where name=lower('DB_RECOVERY_FILE_DEST')", 'Flashback area is a folder where all backup data and logs can be stored and managed by Oracle. If Error: message displayed, then it is not in use.'), 188 189 'Flashback Usage' => array('BACKUP', "select nvl('-','Flashback Area not used') from v\$parameter where name=lower('DB_RECOVERY_FILE_DEST')", '=FlashUsage', 'Flashback area usage.'), 190 191 'Control File Keep Time' => array('BACKUP', "select value from v\$parameter where name='control_file_record_keep_time'",'No of days to keep RMAN info in control file. Recommended set to x2 or x3 times the frequency of your full backup.'), 192 'Recent RMAN Jobs' => array('BACKUP', "select '-' from dual", "=RMAN"), 193 194 // 'Control File Keep Time' => array('BACKUP', "select value from v\$parameter where name='control_file_record_keep_time'",'No of days to keep RMAN info in control file. I recommend it be set to x2 or x3 times the frequency of your full backup.'), 195 'Storage', 'Tablespaces' => array('TABLESPACE', "select '-' from dual", "=TableSpace"), 160 196 false 161 197 … … 165 201 function perf_oci8(&$conn) 166 202 { 203 global $gSQLBlockRows; 204 205 $gSQLBlockRows = 1000; 167 206 $savelog = $conn->LogSQL(false); 168 207 $this->version = $conn->ServerInfo(); 169 208 $conn->LogSQL($savelog); 170 $this->conn =& $conn; 171 } 172 209 $this->conn = $conn; 210 } 211 212 function LogMode() 213 { 214 $mode = $this->conn->GetOne("select log_mode from v\$database"); 215 216 if ($mode == 'ARCHIVELOG') return 'To turn off archivelog:<br> 217 <pre><font size=-2> 218 SQLPLUS> connect sys as sysdba; 219 SQLPLUS> shutdown immediate; 220 221 SQLPLUS> startup mount exclusive; 222 SQLPLUS> alter database noarchivelog; 223 SQLPLUS> alter database open; 224 </font></pre>'; 225 226 return 'To turn on archivelog:<br> 227 <pre><font size=-2> 228 SQLPLUS> connect sys as sysdba; 229 SQLPLUS> shutdown immediate; 230 231 SQLPLUS> startup mount exclusive; 232 SQLPLUS> alter database archivelog; 233 SQLPLUS> archive log start; 234 SQLPLUS> alter database open; 235 </font></pre>'; 236 } 237 238 function TopRecentWaits() 239 { 240 241 $rs = $this->conn->Execute("select * from ( 242 select event, round(100*time_waited/(select sum(time_waited) from v\$system_event where wait_class <> 'Idle'),1) \"% Wait\", 243 total_waits,time_waited, average_wait,wait_class from v\$system_event where wait_class <> 'Idle' order by 2 desc 244 ) where rownum <=5"); 245 246 $ret = rs2html($rs,false,false,false,false); 247 return " <p>".$ret." </p>"; 248 249 } 250 251 function TopHistoricalWaits() 252 { 253 $days = 2; 254 255 $rs = $this->conn->Execute("select * from ( SELECT 256 b.wait_class,B.NAME, 257 round(sum(wait_time+TIME_WAITED)/1000000) waitsecs, 258 parsing_schema_name, 259 C.SQL_TEXT, a.sql_id 260 FROM V\$ACTIVE_SESSION_HISTORY A 261 join V\$EVENT_NAME B on A.EVENT# = B.EVENT# 262 join V\$SQLAREA C on A.SQL_ID = C.SQL_ID 263 WHERE A.SAMPLE_TIME BETWEEN sysdate-$days and sysdate 264 and parsing_schema_name not in ('SYS','SYSMAN','DBSNMP','SYSTEM') 265 GROUP BY b.wait_class,parsing_schema_name,C.SQL_TEXT, B.NAME,A.sql_id 266 order by 3 desc) where rownum <=10"); 267 268 $ret = rs2html($rs,false,false,false,false); 269 return " <p>".$ret." </p>"; 270 271 } 272 273 function TableSpace() 274 { 275 276 $rs = $this->conn->Execute( 277 "select tablespace_name,round(sum(bytes)/1024/1024) as Used_MB,round(sum(maxbytes)/1024/1024) as Max_MB, round(sum(bytes)/sum(maxbytes),4) * 100 as PCT 278 from dba_data_files 279 group by tablespace_name order by 2 desc"); 280 281 $ret = "<p><b>Tablespace</b>".rs2html($rs,false,false,false,false); 282 283 $rs = $this->conn->Execute("select * from dba_data_files order by tablespace_name, 1"); 284 $ret .= "<p><b>Datafile</b>".rs2html($rs,false,false,false,false); 285 286 return " <p>".$ret." </p>"; 287 } 288 289 function RMAN() 290 { 291 $rs = $this->conn->Execute("select * from (select start_time, end_time, operation, status, mbytes_processed, output_device_type 292 from V\$RMAN_STATUS order by start_time desc) where rownum <=10"); 293 294 $ret = rs2html($rs,false,false,false,false); 295 return " <p>".$ret." </p>"; 296 297 } 298 299 function DynMemoryUsage() 300 { 301 if (@$this->version['version'] >= 11) { 302 $rs = $this->conn->Execute("select component, current_size/1024./1024 as \"CurrSize (M)\" from V\$MEMORY_DYNAMIC_COMPONENTS"); 303 304 } else 305 $rs = $this->conn->Execute("select name, round(bytes/1024./1024,2) as \"CurrSize (M)\" from V\$sgainfo"); 306 307 308 $ret = rs2html($rs,false,false,false,false); 309 return " <p>".$ret." </p>"; 310 } 311 312 function FlashUsage() 313 { 314 $rs = $this->conn->Execute("select * from V\$FLASH_RECOVERY_AREA_USAGE"); 315 $ret = rs2html($rs,false,false,false,false); 316 return " <p>".$ret." </p>"; 317 } 318 173 319 function WarnPageCost($val) 174 320 { 175 if ($val == 100 ) $s = '<font color=red><b>Too High</b>. </font>';321 if ($val == 100 && $this->version['version'] < 10) $s = '<font color=red><b>Too High</b>. </font>'; 176 322 else $s = ''; 177 323 178 324 return $s.'Recommended is 20-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>. '; 179 325 } 180 326 181 327 function WarnIndexCost($val) 182 328 { 183 if ($val == 0 ) $s = '<font color=red><b>Too Low</b>. </font>';329 if ($val == 0 && $this->version['version'] < 10) $s = '<font color=red><b>Too Low</b>. </font>'; 184 330 else $s = ''; 185 331 186 332 return $s.'Percentage of indexed data blocks expected in the cache. 187 Recommended is 20 (fast disk array) to 50 (slower hard disks). Default is 0.333 Recommended is 20 (fast disk array) to 30 (slower hard disks). Default is 0. 188 334 See <a href=http://www.dba-oracle.com/oracle_tips_cbo_part1.htm>optimizer_index_caching</a>.'; 189 335 } 190 336 191 337 function PGA() 192 { 193 if ($this->version['version'] < 9) return 'Oracle 9i or later required'; 194 195 $rs = $this->conn->Execute("select a.mb,a.targ as pga_size_pct,a.pct from 196 (select round(pga_target_for_estimate/1024.0/1024.0,0) Mb, 197 pga_target_factor targ,estd_pga_cache_hit_percentage pct,rownum as r 198 from v\$pga_target_advice) a left join 199 (select round(pga_target_for_estimate/1024.0/1024.0,0) Mb, 200 pga_target_factor targ,estd_pga_cache_hit_percentage pct,rownum as r 201 from v\$pga_target_advice) b on 202 a.r = b.r+1 where 203 b.pct < 100"); 204 if (!$rs) return "Only in 9i or later"; 205 $rs->Close(); 206 if ($rs->EOF) return "PGA could be too big"; 207 208 return reset($rs->fields); 209 } 210 338 { 339 340 //if ($this->version['version'] < 9) return 'Oracle 9i or later required'; 341 } 342 343 function PGA_Advice() 344 { 345 $t = "<h3>PGA Advice Estimate</h3>"; 346 if ($this->version['version'] < 9) return $t.'Oracle 9i or later required'; 347 348 $rs = $this->conn->Execute('select a.MB, 349 case when a.targ = 1 then \'<<= Current \' 350 when a.targ < 1 or a.pct <= b.pct then null 351 else 352 \'- BETTER than Current by \'||round(a.pct/b.pct*100-100,2)||\'%\' end as "Percent Improved", 353 a.targ as "PGA Size Factor",a.pct "% Perf" 354 from 355 (select round(pga_target_for_estimate/1024.0/1024.0,0) MB, 356 pga_target_factor targ,estd_pga_cache_hit_percentage pct,rownum as r 357 from v$pga_target_advice) a left join 358 (select round(pga_target_for_estimate/1024.0/1024.0,0) MB, 359 pga_target_factor targ,estd_pga_cache_hit_percentage pct,rownum as r 360 from v$pga_target_advice) b on 361 a.r = b.r+1 where 362 b.pct < 100'); 363 if (!$rs) return $t."Only in 9i or later"; 364 // $rs->Close(); 365 if ($rs->EOF) return $t."PGA could be too big"; 366 367 return $t.rs2html($rs,false,false,true,false); 368 } 369 211 370 function Explain($sql,$partial=false) 212 371 { 213 372 $savelog = $this->conn->LogSQL(false); 214 $rs = &$this->conn->SelectLimit("select ID FROM PLAN_TABLE");373 $rs = $this->conn->SelectLimit("select ID FROM PLAN_TABLE"); 215 374 if (!$rs) { 216 375 echo "<p><b>Missing PLAN_TABLE</b></p> … … 251 410 if ($partial) { 252 411 $sqlq = $this->conn->qstr($sql.'%'); 253 $arr = $this->conn->GetArray("select distinct distinctsql1 from adodb_logsql where sql1 like $sqlq");412 $arr = $this->conn->GetArray("select distinct sql1 from adodb_logsql where sql1 like $sqlq"); 254 413 if ($arr) { 255 414 foreach($arr as $row) { … … 265 424 $id = "ADODB ".microtime(); 266 425 267 $rs = &$this->conn->Execute("EXPLAIN PLAN SET STATEMENT_ID='$id' FOR $sql");426 $rs = $this->conn->Execute("EXPLAIN PLAN SET STATEMENT_ID='$id' FOR $sql"); 268 427 $m = $this->conn->ErrorMsg(); 269 428 if ($m) { … … 273 432 return $s; 274 433 } 275 $rs = &$this->conn->Execute("434 $rs = $this->conn->Execute(" 276 435 select 277 436 '<pre>'||lpad('--', (level-1)*2,'-') || trim(operation) || ' ' || trim(options)||'</pre>' as Operation, … … 287 446 return $s; 288 447 } 289 290 448 291 449 function CheckMemory() 292 450 { 293 451 if ($this->version['version'] < 9) return 'Oracle 9i or later required'; 294 452 295 $rs =& $this->conn->Execute(" 296 select a.size_for_estimate as cache_mb_estimate, 297 case when a.size_factor=1 then 298 '<<= current' 299 when a.estd_physical_read_factor-b.estd_physical_read_factor > 0 and a.estd_physical_read_factor<1 then 300 '- BETTER - ' 301 else ' ' end as currsize, 302 a.estd_physical_read_factor-b.estd_physical_read_factor as best_when_0 303 from (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r from v\$db_cache_advice) a , 304 (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r from v\$db_cache_advice) b where a.r = b.r-1"); 453 $rs = $this->conn->Execute(" 454 select a.name Buffer_Pool, b.size_for_estimate as cache_mb_estimate, 455 case when b.size_factor=1 then 456 '<<= Current' 457 when a.estd_physical_read_factor-b.estd_physical_read_factor > 0.001 and b.estd_physical_read_factor<1 then 458 '- BETTER than current by ' || round((1-b.estd_physical_read_factor)/b.estd_physical_read_factor*100,2) || '%' 459 else ' ' end as RATING, 460 b.estd_physical_read_factor \"Phys. Reads Factor\", 461 round((a.estd_physical_read_factor-b.estd_physical_read_factor)/b.estd_physical_read_factor*100,2) as \"% Improve\" 462 from (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r,name from v\$db_cache_advice order by name,1) a , 463 (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r,name from v\$db_cache_advice order by name,1) b 464 where a.r = b.r-1 and a.name = b.name 465 "); 305 466 if (!$rs) return false; 306 467 … … 308 469 The v$db_cache_advice utility show the marginal changes in physical data block reads for different sizes of db_cache_size 309 470 */ 310 $s = "<h3>Data Cache Estimate</h3>";471 $s = "<h3>Data Cache Advice Estimate</h3>"; 311 472 if ($rs->EOF) { 312 473 $s .= "<p>Cache that is 50% of current size is still too big</p>"; 313 474 } else { 314 $s .= "Ideal size of Data Cache is when \"best_when_0\" changes from a positive number and becomeszero.";475 $s .= "Ideal size of Data Cache is when %BETTER gets close to zero."; 315 476 $s .= rs2html($rs,false,false,false,false); 316 477 } 317 return $s ;318 } 319 478 return $s.$this->PGA_Advice(); 479 } 480 320 481 /* 321 482 Generate html for suspicious/expensive sql … … 413 574 414 575 $s = ''; 576 $timer = time(); 415 577 $s .= $this->_SuspiciousSQL($numsql); 578 $timer = time() - $timer; 579 580 if ($timer > $this->noShowIxora) return $s; 416 581 $s .= '<p>'; 417 582 … … 421 586 422 587 $savelog = $this->conn->LogSQL(false); 423 $rs = &$this->conn->SelectLimit($sql);588 $rs = $this->conn->SelectLimit($sql); 424 589 $this->conn->LogSQL($savelog); 425 590 … … 485 650 486 651 $s = ''; 652 $timer = time(); 487 653 $s .= $this->_ExpensiveSQL($numsql); 654 $timer = time() - $timer; 655 if ($timer > $this->noShowIxora) return $s; 656 488 657 $s .= '<p>'; 489 658 $save = $ADODB_CACHE_MODE; … … 492 661 493 662 $savelog = $this->conn->LogSQL(false); 494 $rs = &$this->conn->Execute($sql);663 $rs = $this->conn->Execute($sql); 495 664 $this->conn->LogSQL($savelog); 496 665 … … 506 675 } 507 676 677 function clearsql() 678 { 679 $perf_table = adodb_perf::table(); 680 // using the naive "delete from $perf_table where created<".$this->conn->sysTimeStamp will cause the table to lock, possibly 681 // for a long time 682 $sql = 683 "DECLARE cnt pls_integer; 684 BEGIN 685 cnt := 0; 686 FOR rec IN (SELECT ROWID AS rr FROM $perf_table WHERE created<SYSDATE) 687 LOOP 688 cnt := cnt + 1; 689 DELETE FROM $perf_table WHERE ROWID=rec.rr; 690 IF cnt = 1000 THEN 691 COMMIT; 692 cnt := 0; 693 END IF; 694 END LOOP; 695 commit; 696 END;"; 697 698 $ok = $this->conn->Execute($sql); 699 } 700 508 701 } 509 702 ?> -
sandbox/2.5.1-evolucao/phpgwapi/inc/adodb/perf/perf-postgres.inc.php
r34 r8222 2 2 3 3 /* 4 V 4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.4 V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved. 5 5 Released under both BSD license and Lesser GPL library license. 6 6 Whenever there is any discrepancy between the two licenses, … … 90 90 function perf_postgres(&$conn) 91 91 { 92 $this->conn =& $conn; 92 $this->conn = $conn; 93 } 94 95 var $optimizeTableLow = 'VACUUM %s'; 96 var $optimizeTableHigh = 'VACUUM ANALYZE %s'; 97 98 /** 99 * @see adodb_perf#optimizeTable 100 */ 101 102 function optimizeTable($table, $mode = ADODB_OPT_LOW) 103 { 104 if(! is_string($table)) return false; 105 106 $conn = $this->conn; 107 if (! $conn) return false; 108 109 $sql = ''; 110 switch($mode) { 111 case ADODB_OPT_LOW : $sql = $this->optimizeTableLow; break; 112 case ADODB_OPT_HIGH: $sql = $this->optimizeTableHigh; break; 113 default : 114 { 115 ADOConnection::outp(sprintf("<p>%s: '%s' using of undefined mode '%s'</p>", __CLASS__, 'optimizeTable', $mode)); 116 return false; 117 } 118 } 119 $sql = sprintf($sql, $table); 120 121 return $conn->Execute($sql) !== false; 93 122 } 94 123
Note: See TracChangeset
for help on using the changeset viewer.