Preformance issue with Dense_Rank

Debilon 431 Reputation points
2022-05-03T04:27:03.467+00:00

well....

I have a table containing 400,000 records.

I'm trying to combine the records and i am using Dense_Rank

Only problem ? after 10 hours of running i still got nothing.

DENSE_RANK()OVER(PARTITION BY FirstName, LastName,HouseNumber,Address,City,State,Zip ORDER BY ISNULL(email,'')DESC) AS RNum_Email
          ,DENSE_RANK()OVER(PARTITION BY FirstName, LastName,HouseNumber,Address,City,State,Zip ORDER BY ISNULL(PhoneNumber,'')DESC) AS RNum_PhoneNumber

Any alternatives ?

Hardware a dell server with 2 E5-2620 V3 and 40 GB Ram.

Developer technologies | Transact-SQL
SQL Server | Other
{count} votes

6 answers

Sort by: Most helpful
  1. Naomi Nosonovsky 8,431 Reputation points
    2022-05-03T19:29:06.1+00:00

    drop table if exists #tempResults;

    ;with cte as (...) -- cte here

    select * into #tempResults from cte

    update myRealTable set ...
    from myRealTable inner join #tempResults t on ....

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.