Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
A Windchill based system can be slow or may appear not to respond for any number of reasons. The underlying reasons can range from the unlikely such as a DNS routing problem to the more common problems like a misconfiguration of JVM or method server parameter. But by far the most common cause of poor Windchill system performance relates to database interaction with Windchill.
Too Many Small SQL statements Being Sent to the Database:
Database related performance problems problems come in two main forms, the first is a problem in the software which results in hundreds or thousands of SQL statements being sent to the database from the method server. With this type of problem each SQL statement executes quickly within the database, but the back and forth of sending the statement and then receiving the results leads to the delay in response. In some cases these types of performance problems are caused by lack of a cache or by an existing cache which is too small, but more commonly these problems are caused by software defects and require a correction to the code from R&D. To identify a code defect relating to missing cache or too many back and forth's, we usually use either the Windchill Profiler or PSM . To identify an undersized cache the Windchill Configuration Assistant (see chapter 1) can be used.
Without using a profiler of some sort it tough for an administrator to know wether there are problems in their system or not or wether to bother looking for them using either the Windchill profiler or PSM. However, using a SQL statement like the one below will identify SQL statements which might be part of scalability problems and warrant further investigation using the PSM or Windchill Profiler.
SQL: Identify SQL statements which could indicate a scalability problem at the application level which needs to be looked into further using PSM or the Windchill Profiler
spool executions.txt
set linesize 200
col LAST_LOAD_TIME for a20
col SQL_TEXT for a60
select username, LAST_LOAD_TIME,EXECUTIONS,SQL_TEXT from v$sql, dba_users
where
(upper(SQL_TEXT) like '%INSERT%'
or upper(SQL_TEXT) like '%DELETE%'
or upper(SQL_TEXT) like '%UPDATE%'
or upper(SQL_TEXT) like '%DBMS_LOB.WRITE%')
and upper(SQL_TEXT) not like '%SELECT%'
and dba_users.user_id=v$sql.PARSING_USER_ID
and EXECUTIONS >250000
and username not in ('SYS','SYSTEM','OUTLN','SYSMAN')
order by EXECUTIONS;
spool off
SQL Statements taking too long in Oracle
The second type of performance problem is a slow running SQL. Unfortunately "Slow" can mean different things depending on the context and who is being affected, if anyone (some SQL statements originate in the BGMS and don't have a user waiting for the response). When I evaluate an Oracle system to identify "Slow" SQL I think of do so in a couple of different ways. I want to find the SQL which cumulatively is taking the most amount of time (per execution time * # number of executions), the SQL statements which don't execute very often but take a long time when they do, sometimes several minutes. Lastly, I look at SQL statements which may not appear in either of the two above lists but primarily because of the disk reads is negatively impacting the rest of the system.
The goal of all three of the queries below is to identify a small handful of SQL which are most impacting the system and need to be improved. When the problem SQL has been identified there a couple of possible next steps:
SQL 1: Identify SQL statements in which combined elapsed times are too long.
Notes:
spool long_cumulative_elapsed_times.txt
set linesize 200
set pagesize 75
col username for a16
col cpu_time_secs for 999,999,999,999
col elapsed_time_secs for 999,999,999,999,999
col Elap_Exec for 999,999,999,999
col ROWS_PROCESSED for 999,999,999,999,999
col executions for 999,999,999
col sql_text for a65
select a.SQL_ID,c.username, CPU_TIME*0.000001 cpu_time_secs,
ELAPSED_TIME*0.000001 elapsed_time_secs,round(ELAPSED_TIME*0.000001/nvl(nullif(executions,0),1)) Elap_per_Exec,
executions,ROWS_PROCESSED,b.piece line#,b.sql_text
from v$sql a, v$sqltext b,dba_users c
where
a.address=b.address
and
(ELAPSED_TIME*0.000001>10 or executions > 1000)
and executions>0
and round(ELAPSED_TIME*0.000001/nvl(nullif(executions,0),1)) >1.99
and c.user_id=a.PARSING_USER_ID
and username not in ('SYS','SYSTEM','OUTLN','SYSMAN')
order by ELAPSED_TIME,CPU_TIME,a.HASH_VALUE, b.piece asc
/
spool off
SQL 2: Identify Long Running SQL statements
spool long_eplapsed_time.txt
set linesize 200
set pagesize 75
col username for a16
col cpu_time_secs for 999,999,999,999
col elapsed_time_secs for 999,999,999,999,999
col Elap_Exec for 999,999,999,999
col LAST_LOAD_TIME for a20
col executions for 999,999,999
col sql_text for a65
select c.username,CPU_TIME*0.000001 cpu_time_secs,
ELAPSED_TIME*0.000001 elapsed_time_secs,
round(ELAPSED_TIME*0.000001/nvl(nullif(executions,0),1)) Elap_per_Exec,
executions,LAST_LOAD_TIME,
b.piece line#,
b.sql_text sql_text
from v$sql a, v$sqltext b, dba_users c
where
a.address=b.address
and
(
ELAPSED_TIME*0.000001>10
or executions > 1000
)
and executions>0
and c.user_id=a.PARSING_USER_ID
and round(ELAPSED_TIME*0.000001/nvl(nullif(executions,0),1)) >20
and username not in ('SYS','SYSTEM','OUTLN','SYSMAN')
order by Elap_per_Exec,ELAPSED_TIME,CPU_TIME,a.HASH_VALUE, b.piece asc;
/
spool off
SQL3 : Resource Intensive SQL statements
spool resource_intensive_sql_statements.txt
set linesize 160
set pagesize 75
col buffer_gets for 999,999,999,999
col disk_reads for 999,999,999,999
col "% Bad" for 99.999
col sql_text for a64
select SQL_ID,HASH_VALUE,BUFFER_GETS,DISK_READS,EXECUTIONS,LINE#,bad "% Bad",SQL_TEXT from (
select a.SQL_ID SQL_ID,buffer_gets,disk_reads,executions,b.piece line#,a.HASH_VALUE HASH_VALUE,
((disk_reads*1000)+buffer_gets)/tot.sumed*100 bad ,b.sql_text sql_text
from v$sql a, v$sqltext b,
(select sum((disk_reads*1000)+buffer_gets) sumed from v$sql) tot
where
a.address=b.address
and
(
disk_reads > 1000
or buffer_gets>100000
or executions > 1000
))
where bad >3
order by disk_reads*1000 + buffer_gets ,HASH_VALUE,line# asc
/
spool off
Note: All above SQL statements are intended to be run from SQL*Plus as the sys or system user.