Can't batch insert with identity PK

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
aerotog
Posts: 4
Joined: Tue 12 Jul 2016 21:56

Can't batch insert with identity PK

Post by 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)?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Can't batch insert with identity PK

Post by 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 ... dates.html.

Post Reply