Can't batch insert with identity PK

Can't batch insert with identity PK

Postby aerotog » Wed 22 Mar 2017 20:29

Using LinqConnect 4.5.1090 with MS SQL Server.

Recently we've been looking at database performance improvement and realized that several of our INSERT statements were taking much longer than others. After looking more closely at the SQL statements, it appears that any table with an IDENTITY column or a TIMESTAMP column is not using batch updates.

I've looked through the forums and seen a few posts related to this without a solid answer/solution to the following question:

Is it possible to batch INSERT to a table that has an auto-generated column (i.e. IDENTITY or TIMESTAMP)?
aerotog
 
Posts: 4
Joined: Tue 12 Jul 2016 21:56

Re: Can't batch insert with identity PK

Postby Shalex » Thu 23 Mar 2017 18:26

aerotog wrote:Is it possible to batch INSERT to a table that has an auto-generated column (i.e. IDENTITY or TIMESTAMP)?
You can do that, but you should set Auto-Sync=Never for your AutoGeneratedValu=True and IsVersion=True properties to avoid generation of the RETURNING clause which is not supported by Batch Updates: https://www.devart.com/linqconnect/docs/?BatchUpdates.html.
Shalex
Devart Team
 
Posts: 7824
Joined: Thu 14 Aug 2008 12:44


Return to LinqConnect (LINQ to SQL support)