The fastest way to insert many records into a database

I insert a record into the database (100,1,000, 10,000 and 100,000) using 2 methods (this is a table without a primary key and an index)

  • using for and inserting one at a time
  • using stored procedure

Time, of course, is better to use a stored procedure. My questions: 1) if I use an index, the operation will be faster and 2) Is there any other way to do the insertion

PS: I use ibatis as ORM if that matters

+3
source share
4 answers

Check out SqlBulkCopy .

. TableLock BatchSize 10 000, .

.

SQLBulkCopy

+5

, , , . , , .

, , , . , , .

. , , ( SQLServer).

+2
0

Source: https://habr.com/ru/post/1754555/


All Articles