Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

1st execute SQL take much longer than 2nd execute

Status
Not open for further replies.

markco

IS-IT--Management
Jan 8, 2001
25
HK
If I have a SQL to retrive some data from DB and under the following condition, how can I check what should be the problem?
1) when the first time to run the SQL, it take about 30 sec to fatch all data back to the application. When the first run, the CPU loading is low but the disk IO is high.

2) After the first run, if I rerun the SQL again, it only take about 2 sec to fatch all data back. When the 2nd run, the CPU loading is high but the disk IO is low.

3) after the 2nd run, afterward execute the SQL, only take about 2 sec to fatch all data.

I had check the v$librarycache.gethitratio (SQL AREA) is about 0.998. Beside, what can I check? Markco Wong
 
Your data is probably not in the buffer cache, so Oracle should read it from disk at first time.

select (1-(sum(decode(name,'physical reads',value,0))/
(sum(decode(name,'db block gets',value,0))+
sum(decode(name,'consistent gets',value,0)))))*100
"Hit Ratio" from v$sysstat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top