why compare feature values between two tables take too much time ?
ahmed salah
3,166
Reputation points
I work on sql server 2019 i face issue when compare feature values between two tables ,
it take too long time to display result
time that take it 5 minute .
total rows on every table i compare it is 13 milion rows
query is
select o.RecomendationId,case when CONVERT(VARCHAR(32), HashBytes('SHA2_256',f1.DiffFeatures),2) =CONVERT(VARCHAR(32), HashBytes('SHA2_256',o.DiffFeatures),2) then 0 else 1 end as DiffValues into ExtractReports.dbo.TechnologyEqualOriRecomended from ExtractReports.dbo.TechnologyOriginalFeaturesEqual o with(nolock)
inner join ExtractReports.dbo.TechnologyRecomendedFeaturesEqual f1 with(nolock) on f1.RecomendationId=o.RecomendationId ---and f1.DiffFeatures=o.DiffFeatures
group by o.RecomendationId,f1.DiffFeatures,o.DiffFeatures
ddl structure
CREATE TABLE [dbo].[TechnologyOriginalFeaturesEqual](
[RecomendationId] [int] NOT NULL,
[DiffFeatures] [varchar](500) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
CREATE TABLE [dbo].[TechnologyRecomendedFeaturesEqual](
[RecomendationId] [int] NOT NULL,
[DiffFeatures] [varchar](500) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
execution baln as below
https://www.brentozar.com/pastetheplan/?id=rJzXglKgo
so what i do to enhance performance to run faster