Good afternoon all,I am working on a script that will remove duplicate records from a very large table (40 mil + records). It is taking forever to accomplish, and I have two questions:1. Does anyone know of a better way than my query below to accomplish this?2. Could I add indexes to my _DeDup table to help?Any guidance would be appreciated! --------------------------------------------------------------------------------------------DEDUP tDuplicatesExist--------------------------------------------------------------------------------------------Back up the dataSelect * into MyDatabase.dbo.tDuplicatesExist_090421 from tDuplicatesExist<br/>--get data to dedupSelect * into tDuplicatesExist_dedup from tDuplicatesExist--Truncate the original table to insert distinct records back in Truncate table tDuplicatesExist SET IDENTITY_INSERT MyDatabase.dbo.tDuplicatesExist ON --Keep orig PK/RecordNumberInsert tDuplicatesExistSelect tDuplicatesExist_DeDup.RecordNumber, --Pk/Unique Identifier tDuplicatesExist_DeDup.EmployeeID, tDuplicatesExist_DeDup.AccountID, tDuplicatesExist_DeDup.TransactionType, tDuplicatesExist_DeDup.TransactionData, tDuplicatesExist_DeDup.TransactionDate from tDuplicatesExistJOIN( Select distinct EmployeeID, AccountID, TransactionType, convert(datetime,convert(varchar(10),TransactionDate,101))TDate, Max(RecordNumber) RecordNumber From tDuplicatesExist_DeDup d Group by EmployeeID, AccountID, TransactionType, convert(datetime,convert(varchar(10),TransactionDate,101)) as Aon tDuplicatesExist_DeDup.RecordNumber = A.RecordNumberSET IDENTITY_INSERT MyDatabase.dbo.tDuplicatesExist OFF