I'm having difficulty coming up with an index for this update query.
UPDATE MarketInsight
SET G_ULT_CNTRY = b.COUNTRY_CD
FROM MarketInsight INNER JOIN MarketInsight AS b ON MarketInsight.G_ULT_DUNS = b.DUNS
WHERE MarketInsight.G_ULT_CNTRY is null;
The table has approximately 90 million records with each record having about 80 fields. It is a recursive join. The only thing on the table is the primary key which is the DUNS field. All the fields are text based. DUNS and G_ULT_DUNS are 9 characters, and
COUNTRY_CD and G_ULT_CNTRY are 2 characters. With this setup it takes the update query 65-70 minutes to run
I have tried an index on G_ULT_DUNS with an included field of G_ULT_CNTRY; however, this only reduced the processing time by about 5 to 6 minutes.
Not sure if I need to include country_cd or move g_ult_cntry from included field to actual index field.
Any suggestions or insight would be appreciated.
Thanks,