none
SqlTransaction - Overuse and Overhead RRS feed

  • Question

  • When using SqlTransaction in ADO.NET, I would like to understand what are the effect of overusing SqlTransaction, for example:

    - Unnecessarily using SqlTransaction when query / get data

    - Unnecessarily using SqlTransaction when insert only single command / single table

    I would like to know if there's any performance impact and how serious the performance impact is.

    thx.

    Thursday, April 18, 2013 1:20 PM

Answers

  • Hi Daniell,

    Unnecessarily using SqlTransaction will have an overhead locking and unlocking the data. However, properly using SqlTransaction may benefit the performance.

    You may have a look at this thread for more information.

    http://stackoverflow.com/questions/5091084/ado-net-sqltransaction-improves-performance

    You can also find some test result about inserting / updating from this blog:

    http://blog.staticvoid.co.nz/2012/4/26/making_dapper_faster_with_transactions

    Best regards,

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information for your  convenience. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.



    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Tuesday, April 23, 2013 8:11 AM
    Moderator