性能降低-加入dbo.StringList SQL Server

时间:2019-05-08 07:14:41

标签: sql-server performance

我需要更新特定人群的表。

代码:

@IdentityNumbers dbo.StringList readonly

update d
   set DeliveryNationalInsuranceBatchLogId = @BatchLogId,
       LastUpdateDate=getdate(),
       LastUpdateUserId=-999
  from MortgageDetails d join MortgageReturnParticipationBase b
    on b.Id = d.MortgageReturnParticipationBaseId join @IdentityNumbers newRow
    on (newRow.item = b.IdentityNumber or newRow.item = b.MateIdentityNumber)
 where (DATEADD(YEAR,70,BirthDate) <= getdate() or (MateBirthDate is null or DATEADD(YEAR,70,MateBirthDate) <= getdate()))
   and b.CheckWithNationalInsurance=1
   and d.IsActive=1
   and b.MortgageReturnParticipationStatusId=1

我做到了,它只需要几秒钟到一分钟就可以容纳大约10,000名董事会成员,而大约500,000名需要一个小时...

我认为原因是此StringList减慢了速度...

这真的是问题吗?有解决办法吗?

0 个答案:

没有答案