m0nkey
MIS
- Mar 20, 2003
- 31
Can someone please look over this code and tell me if there is anything that they can recommend to speed it up...I have all the qualified fields indexed or clustered and the thing is, it runs fast (<1 sec) if i run it without the last line: "AND A.zipcode is null", otherwise it runs for 3.5 minutes... 
I am not sure why this is slowing this query down so much. The source table [20054_dup] is large:90 million entries but only 6 columns. acct_no is clustered and zipcode is indexed. the avoid_areas table is only 10K records and has 2 columns. The zipcode is clustered. i have tried this with a hint and without. the execution plan shows the additional hash match/right ourter joins, parallelism and clustered index scans when i add this final paft of the left outer join.
Am i missing something with this query? Please let me know if you see something awry or can sugesst a tune somewhere...
Select distinct top 1000 D.acct_no, D.zipcode
from [20054_dup] D With (tablockx, holdlock)
left outer join avoid_areas A WITH(INDEX(IX_avoid_areas)) on A.zipcode = D.zipcode
left outer join repo_35 R on R.acct_no= D.acct_no
WHERE D.timezone = '6'
AND R.acct_no is null
AND D.problem = '0'
AND A.zipcode is null
I am not sure why this is slowing this query down so much. The source table [20054_dup] is large:90 million entries but only 6 columns. acct_no is clustered and zipcode is indexed. the avoid_areas table is only 10K records and has 2 columns. The zipcode is clustered. i have tried this with a hint and without. the execution plan shows the additional hash match/right ourter joins, parallelism and clustered index scans when i add this final paft of the left outer join.
Am i missing something with this query? Please let me know if you see something awry or can sugesst a tune somewhere...
Select distinct top 1000 D.acct_no, D.zipcode
from [20054_dup] D With (tablockx, holdlock)
left outer join avoid_areas A WITH(INDEX(IX_avoid_areas)) on A.zipcode = D.zipcode
left outer join repo_35 R on R.acct_no= D.acct_no
WHERE D.timezone = '6'
AND R.acct_no is null
AND D.problem = '0'
AND A.zipcode is null