zzzprojects / Dapper-Plus

Dapper Plus - High-Efficient Bulk Actions (Insert, Update, Delete, and Merge) for .NET
https://dapper-plus.net/
383 stars 85 forks source link

Hints for sql server #93

Open ghost opened 3 years ago

ghost commented 3 years ago

Hello there.

We have encountered the deadlock while using BulkInsert from DapperPlusActionSet. The deadlock is happened due to the concurrent update of the parent table and insert to a child table in few different transactions. The possible way to fix the issue is to use the SQL server hint for the insert query: OPTION (LOOP JOIN). However, I did not find any way to specify the hint while using dapperplus methods.

Is there a way to specify SQL server hints for insert statement located in the merge statement produced by the BulkInsert method?

Thanks.

JonathanMagnan commented 3 years ago

Hello @Rodale ,

There is currently no way to specify hint but I will talk with my developer tomorrow about this request.

Best Regards,

Jon

JonathanMagnan commented 3 years ago

Hello @Rodale ,

I speak with my developer and we are not sure exactly where you will put the option OPTION (LOOP JOIN).

Our library uses the MERGE statement and not an "INSERT SELECT + INNER

Is it possible for you to provide an example of syntax? We want to make sure that's possible and it will currently work with the way we already generate our SQL.

Best Regards,

Jon

JonathanMagnan commented 3 years ago

Hello @Rodale ,

Since our last conversation, I haven't heard from you!

As mentioned in my previous message, we are not sure exactly where you will put the option OPTION (LOOP JOIN).

Don't hesitate to provide an example of syntax so we can assist you better.

Looking forward to hearing from you,

Jon

JonathanMagnan commented 3 years ago

Hello @Rodale ,

A simple reminder that we are here to assist you!

Don't hesitate to provide an example of syntax so we can help you better.

Looking forward to hearing from you,

Jon