Why does the first WHERE clause take so much longer than the sum of the parts? Anything I can do within the WHERE clause to improve the processing time?
I can't change the DB. There are also 5 inner joins and 3 outer joins with a few addition filters embedded... e.g. LEFT OUTER JOIN B ON (A.ID = B.LoanID AND B.Flag = 1)
Thank you,
Brian
I can't change the DB. There are also 5 inner joins and 3 outer joins with a few addition filters embedded... e.g. LEFT OUTER JOIN B ON (A.ID = B.LoanID AND B.Flag = 1)
Thank you,
Brian
Code:
~20 - 25 seconds
WHERE (((A.Status IN ('NEW', 'PRESETTLED', 'SETTLED') AND ISNULL(B.Status,'') NOT in ('SOURCED')) OR A.Status IN ('SOURCED') and ISNULL(B.Status,'') not in ('CLOSED')) AND (C.ID in ('2456'))) OR D.PoolID in ('904')
Vs
~ 5 seconds
WHERE (((A.Status IN ('NEW', 'PRESETTLED', 'SETTLED') AND ISNULL(B.Status,'') NOT in ('SOURCED')) OR A.Status IN ('SOURCED') and ISNULL(B.Status,'') not in ('CLOSED')) AND (C.ID in ('2456')))
Vs
~ 5 seconds
WHERE D.PoolID in ('904')
[code]