Home » RDBMS Server » Performance Tuning » Tune the query (Oracle9i)
Tune the query [message #486465] Wed, 15 December 2010 15:08 Go to next message
ajaykumarkona
Messages: 399
Registered: August 2010
Senior Member
Hi Experts,

The following query is taking neraly 6 minutes.
Can you please help me to tune this query

SELECT    
a.empno,
c.phtp,
c.ccode,
c.city,
c.phone  

FROM    b,
        a,
        c,
        d,
        e,
        f
 WHERE c.empid = a.empno
   AND TRUNC (c.dt) = (SELECT TRUNC (MAX (dt))
                                        FROM c)
   AND c.phtp IN ('MOB','LAN','WTK')
   AND b.plid(+) = a.plid
   AND a.empno = d.empno
   AND c.status = 'G'
   AND d.empno = e.empid
   and b.cd=f.cd
   ORDER BY a.empno          



The table A is having 18856 records.

The table B is having 2702 records.

The table C is having 322067 records.

The table D is having 18856 records.

The table E is having 19721 records.

The table F is having 239 records.


c.phtp IN ('MOB','LAN','WTK') is retrieveing 128908

c.status is having total 322067 records with the values only "G" and "H"

WHERE status ='H' is having 52171 records.

WHERE STATUS='G' is having 269896 records.

The following are the indexes are available.

TABLE_NAME	COLUMN_NAME

A	         EMPNO
B	         PLID
C	         EMPID
C	         EMPID
C	         PHTP
C	         PHTP
F                CD
F                CD

If we craete Bitmap index on c.status column ,

can performance will be improved?

It is(c.status) having only the values "G" and "H" for "G" 269896 records,for "H" 52171 records.

Could you please check whether the Driving tables and Driver tables are postioned correctly or not.
Because I am not having much idea on driver and drivining table.

Please help me to improve the performance of this query.

Thanks in advance
Re: Tune the query [message #486467 is a reply to message #486465] Wed, 15 December 2010 15:14 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Since only tables A & C contribute data to SELECT clause,
all the other tables should be subordinated into WHERE clause.

post EXPLAIN PLAN
Re: Tune the query [message #486472 is a reply to message #486467] Wed, 15 December 2010 17:05 Go to previous messageGo to next message
ajaykumarkona
Messages: 399
Registered: August 2010
Senior Member
c.status is having only the values "G" and "H" for "G" 269896 records,for "H" 52171 records.

Is it right way to create Bitmap Index on this column.
Re: Tune the query [message #486473 is a reply to message #486472] Wed, 15 December 2010 17:09 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Is it right way to create Bitmap Index on this column.
BITMAP index should be avoided in OLTP applications; but are OK in data warehouse application
Re: Tune the query [message #486474 is a reply to message #486473] Wed, 15 December 2010 17:17 Go to previous message
cookiemonster
Messages: 13922
Registered: September 2008
Location: Rainy Manchester
Senior Member
What does this give:
SELECT COUNT(*) from c 
WHERE TRUNC (c.dt) = (SELECT TRUNC (MAX (dt))
                                        FROM c)
AND c.phtp IN ('MOB','LAN','WTK')
AND c.status = 'G';


Why is the outer-join there? Why optionally join to a table you select no data from?
Previous Topic: dbms_job
Next Topic: Change in explain plan due to Oracle upgrade
Goto Forum:
  


Current Time: Tue May 14 01:58:20 CDT 2024