Link to home
Start Free TrialLog in
Avatar of Rao_S
Rao_S

asked on

Oracle, poor performance

below query in our process which is taking between 7-8 seconds when executed. when you execute the same query by commenting out the condition AND INBOUND_OUTBOUND_IND = 'I', it returns within milli seconds. The column INBOUND_OUTBOUND_IND is partitioned. we included the column in the condition to gain performance (searching 1 million records vs total 3 million records). other queries using INBOUND_OUTBOUND are just working fine, but this one is not. Could you please review and let us know why the condition on this column which is supposed to gain a performance is hurting us. If it can be fixed by defining any indexes on the database side, please let me know. any help in this regard is greatly appreciated.

SELECT inbound_seq_pk
      FROM aqtit01.tqt_it_inbound_seq
     WHERE inbound_seq_pk = (SELECT inbound_seq_pk
                           FROM (SELECT inbound_seq_pk, rownum AS rn
                                   FROM Aqtit01.TQT_IT_INBOUND_SEQ inboundSeq
                                  WHERE Inbound_Seq_Pk IN (SELECT Inbound_Seq_Pk
                                                             FROM Aqtit01.TQT_IT_Inbound_Parent
                                                            WHERE PARENT_MATRL IN (SELECT PARENT_MATRL
                                                                                     FROM Aqtit01.TQT_IT_Inbound_Parent
                                                                                    WHERE Inbound_Seq_Pk = 3349801) )
                                    AND Seq_Nbr     < 20110927191030002
                                    AND STS_CDE not in ('RESPONSE_SUCCESS')
                                    AND INBOUND_OUTBOUND_IND = 'I'
                                  ORDER BY seq_nbr
                                ) a
                          WHERE a.rn = 1)
                          AND STS_CDE not in ('RESPONSE_SUCCESS')
Avatar of Devinder Singh Virdi
Devinder Singh Virdi
Flag of United States of America image

>> The column INBOUND_OUTBOUND_IND is partitioned.

Please provide us execution plan with/without INBOUND_OUTBOND_IND and list of all indexes available along with column.
Avatar of Rao_S
Rao_S

ASKER

attached expalin plan output.. txqm1-poor-query-explain-1.xls
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rao_S

ASKER

hi slightwv, the dba implemented a sql profile for the statement, the cost of the old explain plan was 7,970,617856, the new cost is 37,485,208. there was a gain the application performance.

the inbound_sequence_pk is no longer valid today and the sts_cde for that seq_pk has been to changed to 'O'. so i cannot send you the cost plan with "AND INBOUND_OUTBOUND_IND = 'I'" commented out....

with regards to indexes.. (if u check the explain plan)...these are the indexes being used....
PKQT_IT_INBOUND_SEQ is indexed on inbound_seq_pk and is the primary key..
XQT_IT_INBOUND_SEQ_N9 is indexed on seq_nbr..
XQT_IT_INBOUND_PARENT_U1 is indexed on inbound_seq_nbr,parent_matrl..
XQT_IT_INBOUND_PARENT_N2 is indexed on parent_matrl,inbound_seq_pk...

i am not sure about whether the indexes are local or global...but if u look at the expalin plan....TABLE ACCESS BY GLOBAL INDEX ROWID ....probably means the partitioned index is global...?

>>new cost is 37,485,208

Then where was the plan you posted generated?  I don't see costs that high.
Avatar of Rao_S

ASKER

that is correct... i thought so too...that is what the dba told us....so do you know how he would have calculated the cost..?
>>so do you know how he would have calculated the cost..?

No.  You will need to ask them.

Also, if performance is no longer an issue because you moved from 'I' to 'O' then is there still a question here?
Avatar of Rao_S

ASKER

nope, no question... related to the query above...i will go ahead and close the question..
Avatar of Rao_S

ASKER

Thank you...