Fast SQL runs slow on identical database
Question: The same SQL runs on both servers.
Sometime the SQL runs fast(< 1 sec) and sometime the SQL response
time is slow (> 15 sec). Each server is on a different
network. The databases are about 99% the same with some minor
differences. If we open 2 sessions on the same server/database, 1
SQL session will run fast and the other SQL will run slow. Both
session are using the same execution path. Theses queries have been
running in production for over a year and have not changed.
How do I diagnose this sporadic SQL performance issue?.
Answer: When I see sporadic SQL
performance, I start by exploring whether we have a shortage of a
shared system resource, either network, RAM, disk enqueues, or CPU.
If you can witness the slow SQL, run two STATSPACK or AWR
snapshots, 5 minutes apart, and get the elapsed time report!
Then, feed the report into
AWR Analyzer
That will show us
EXACTLY why the SQL is slow!
I would start by monitoring the
OS environment for stress related shortages.
You can run a
daemon vmstat background process script on
Solaris, that stuffs the vmstat data into tables every 5 minutes:
Diagnose sporadic SQL response time
1 - Monitor RAM and CPU with
vmstat:
2 - Monitor for disk
enqueues with iostat:
3 - Monitor network with netstat
I'm going to bet that you will see some shared resource shortage
during the time that the SQL runs slow . . .
For a complete SQL troubleshooting methodology, see my book
Advanced Oracle SQL Tuning.
|
|
Get the Complete
Oracle SQL Tuning Information
The landmark book
"Advanced Oracle
SQL Tuning The Definitive Reference" is
filled with valuable information on Oracle SQL Tuning.
This book includes scripts and tools to hypercharge Oracle 11g
performance and you can
buy it
for 30% off directly from the publisher.
|
|
|
Get the Complete
Oracle SQL Tuning Information
The landmark book
"Advanced Oracle
SQL Tuning The Definitive Reference" is
filled with valuable information on Oracle SQL Tuning.
This book includes scripts and tools to hypercharge Oracle 11g
performance and you can
buy it
for 30% off directly from the publisher.
|