SQL Server Optimize Insert Performance In 5 Steps. What are the possible reasons of the slow table insert? What are ways to identify this bottleneck without the execution plan?

  • DROP ALL triggers and constraints on the table
  • DROP ALL indexes (except the ones that are needed by the insert)
  • Prevent page splits: make sure you use a clustered index that new records will be inserted at the end of the table. Use an IDENTITY column as the primary key.
  • Don’t leave empty space in the table: set the fill factor to 0 or 100 (same), reducing the number of pages that the data is spread across.
  • Reduce transaction log overhead: change the recovery model of the database to Simple

Frequently asked questions

How do I speed up inserts into a SQL Server table?

Drop all triggers, constraints and unneeded indexes. Prevent page splits with an IDENTITY clustered key. Set the fill factor to 0 or 100. Reduce transaction log overhead with the Simple recovery model.

How do I prevent page splits when inserting rows in SQL Server?

Use a clustered index where new records go at the end of the table. Use an IDENTITY column as the primary key.

What fill factor is best for insert performance?

Set the fill factor to 0 or 100, which are the same. This leaves no empty space in the table and reduces the number of pages the data is spread across.

How do I reduce transaction log overhead for inserts?

Change the recovery model of the database to Simple. This reduces the overhead on the transaction log during the insert.

Which indexes should I drop to speed up a table insert?

Drop all indexes except the ones the insert needs. Also drop all triggers and constraints on the table.

Comments

Your email address is not shown. A photo comes from Gravatar, if you have one.