How do I make my SQL insertion faster?


Velocizzare gli inserimenti SQL Server

La soluzione più semplice è batch commit.
Per esempio, completare ogni mille inserimenti o ogni secondo. This will fill up the log pages and reduce the cost of the log flush wait for every insert in one transaction.

Metodi efficaci per inserire dati in SQL Server

  • Prova la classe SqlBulkCopy.
    Allows you to bulk load a SQL Server table with data from another source efficiently.
  • Elimina tutti i trigger e i limiti presenti sul tavolo.
  • Elimina tutti gli indici tranne quelli richiesti dall’inserimento.
  • In ogni caso, assicurati che il tuo clustered index inserisca sempre nuovi record alla fine della tabella. Un’identity column è sufficiente.

Inserire più righe con un’unica dichiarazione

È vero che puoi inserire più righe in una sola INSERT statement invece di inserire ogni row in un’altra INSERT statement.
In order to accomplish this, follow the statement’s VALUES clause and list the values for each row separated by commas.

Lascia un commento