I have a table variable:
DECLARE @to_process TABLE ( [Id] [bigint] NOT NULL, [SequenceId] [bigint] NOT NULL, ... ) INSERT INTO @to_process ( Id , SequenceId ... ) SELECT TOP (@recordsToProcess) Id , SequenceId ...
in my stored procedure. I have investigated that insert into it spends about 66% of total execution time.
How can I improve or optimize my code to speed up my sp execution?