Topic
1 reply Latest Post - ‏2010-07-01T15:10:10Z by SystemAdmin
SystemAdmin
SystemAdmin
9 Posts
ACCEPTED ANSWER

Pinned topic Query optimization

‏2010-07-01T14:54:49Z |
I am putting a condition in where clause as:
C.LN5 = PD.LN5 AND C.FN3 = PD.FN3
and it is executing in around 20 seconds
when putting this
C.INS_LN5 = PD.INS_LN5 AND C.INS_FN3 = PD.INS_FN3
execution time is around 1 second
but combining both with OR like this
((C.LN5 = PD.LN5 AND C.FN3 = PD.FN3)
OR (C.INS_LN5 = PD.INS_LN5 AND C.INS_FN3 = PD.INS_FN3))

is yielding result in around 20 minutes.

If any clue please suggest.
Updated on 2010-07-01T15:10:10Z at 2010-07-01T15:10:10Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    9 Posts
    ACCEPTED ANSWER

    Re: Query optimization

    ‏2010-07-01T15:10:10Z  in response to SystemAdmin
    The OR is causing a table scan. Try writing it using UNION.

    Andy