I am performing some test on sql server and I want to get the best insert speed possible. The statement I use is something like this:
INSERT INTO db_Test_d
you can use in your store procedure before end
OPTION(RECOMPILE)
Have you considered using SqlBulkCopy? You need to build a DataTable and pass it to the WriteToServer routine.
It's FAST!
To get the best possible performance you should:
Are multiple clients inserting records in parallel? If so then you should also consdier the locking implications.
Note that SQL Server can suggest indexes for a given query either by executing the query in SQL Server Management Studio or via the Database Engine Tuning Advisor. You should do this to make sure you haven't removed an index which SQL Server was using to speed up the INSERT
.
If this still isn't fast enough then you should consider grouping up inserts an using BULK INSERT instead (or something like the bcp utility or SqlBulkCopy, both of which use BULK INSERT
under the covers). This will give the highest throughput when inserting rows.
Also see Optimizing Bulk Import Performance - much of the advice in that article also applies to "normal" inserts.