Question on connection pooling and concurrent transactions

  • Hi,

    I have a transaction with , lets say, 5 INSERT/UPDATE statements with some SELECT statements in between. I am using one connection for all the update/insert statements and another connection for SELECT statements from connection pool. Is there any problem doing do? Should I use the connection intended for UPDATE/INSERT statements for SELECT statements also?

    Thanks,

    TNV

  • You have a single transaction where you are mixing INSERT/UPDATE and SELECT? Be very careful that you're performing these actions in the same order or you'll be getting deadlocks all over the place.

    In general, you shouldn't have a single transaction that needs to span multiple connections. As to whether or not you can use different connections for SELECT vs. INSERT/UPDATE, yes, you can or you can put them through the same connection, but spanning a transaction across connections sounds like a very serious recipe for trouble.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply