Bulk insert performance optimization

1
Voted

Join inserts for the same table into one insert statement.

Currently LS produces the following code:

INSERT INTO entity1 (id, value) VALUES (1, 'A');
INSERT INTO entity1 (id, value) VALUES (2, 'B');
INSERT INTO entity1 (id, value) VALUES (3, 'C');
INSERT INTO entity1 (id, value) VALUES (4, 'D');

The following code would be more optimized

INSERT INTO entity1 (id, value) VALUES 
           (1, 'A'),
           (2, 'B'),
           (3, 'C'),
           (4, 'D');

Difference on "our" MSSQL-database where indexed views depend on table entity1:

350 Batch-Inserts: 18s Insert with 350 values: <1s

Execution time is mainly reduced in the following areas: - Compile time - view indizes - Clustered index of entity1

Status: New