Performance issue [message #522091] |
Tue, 06 September 2011 07:21 |
|
a_oracle
Messages: 98 Registered: November 2010
|
Member |
|
|
Hi All,
I have a query like:
select t1.col1,t1.col2....t1.coln
from t1,t2
where <condition having joins between the 2 tables>
union all
select t1.col1,t1.col2....t1.coln
from t1,t2,t3
where <condition having joins between the 3 tables>.
Now, the above query is running for long and doesnt comeplete even in 2-3 hours of running. When I ran this query in
another database it ran in les than 10 seconds. Both the database hasve the tables analysed and the statitics are up to date
with the analyse date being same in both the databses. The record count also seems to be perfect matching for each table.
I cant post an explain plan as the database is secured and we are prohibited to take out the same in both the databases.
Can you please suggest what all other parameters i should be looking into for a possible resolution?
|
|
|
|
Re: Performance issue [message #522388 is a reply to message #522092] |
Fri, 09 September 2011 03:33 |
|
msol25
Messages: 396 Registered: June 2011
|
Senior Member |
|
|
hi a_Oracle,
Please post your query properly and give explain plan for getting decision from orafaq.But may be
you have some restriction,so just check these points on priority:
1. Check user_tables and then find out last_analyzed date in all three tables like
select last_analyzed
from user_tables
where table-name in ('abc','def','ghi');
2. Then check hit ratio using query:
SELECT 'Buffer Cache' NAME,
ROUND ( (congets.VALUE + dbgets.VALUE - physreads.VALUE)* 100/ (congets.VALUE + dbgets.VALUE),2) VALUE
FROM v$sysstat congets
,v$sysstat dbgets
,v$sysstat physreads
WHERE congets.NAME = 'consistent gets'
AND dbgets.NAME = 'db block gets'
AND physreads.NAME = 'physical reads'
UNION ALL
SELECT 'Execute/NoParse',
DECODE (SIGN (ROUND ( (ec.VALUE - pc.VALUE)* 100/ DECODE (ec.VALUE, 0, 1, ec.VALUE),2)),-1, 0,ROUND ( (ec.VALUE - pc.VALUE)* 100/ DECODE (ec.VALUE, 0, 1, ec.VALUE),2))
FROM v$sysstat ec
,v$sysstat pc
WHERE ec.NAME = 'execute count'
AND pc.NAME IN ('parse count', 'parse count (total)')
UNION ALL
SELECT 'Memory Sort',
ROUND ( ms.VALUE/ DECODE ((ds.VALUE + ms.VALUE), 0, 1, (ds.VALUE + ms.VALUE))* 100,2)
FROM v$sysstat ds
,v$sysstat ms
WHERE ms.NAME = 'sorts (memory)' AND ds.NAME = 'sorts (disk)'
UNION ALL
SELECT 'SQL Area get hitrate'
,ROUND (gethitratio * 100, 2)
FROM v$librarycache
WHERE namespace = 'SQL AREA'
UNION ALL
SELECT 'Avg Latch Hit (No Miss)'
,ROUND ((SUM (gets) - SUM (misses)) * 100 / SUM (gets), 2)
FROM v$latch
UNION ALL
SELECT 'Avg Latch Hit (No Sleep)',ROUND ((SUM (gets) - SUM (sleeps)) * 100 / SUM (gets), 2)
FROM v$latch;
Execute this query and try to find out hit ratios in both databses i.e. where query is executing slow and other one where query execution
is very fast.
3. If not getting answer then please paste your execution plan and with table size i.e. total number of rows in these tables.
Normally it happens when variable SGA component vary in size because of redo entries in shared pool in case of Shared server envtt..But in case of shared server envtt. union all will have little bit usage of rollback segment
because no sorting will be done in UNION ALL.
I expect that problem should be in your hit ratio for Library cache,data dictionary cache,database buffer cache etc.
|
|
|
|