sql - Does SqlConnection processes queries in parallel? -


if open sqlconnection sql server, , issue multiple queries multiple background threads, using 1 connection - queries executed sequentially (don't care order)?

specifically, if @ beginning of 1 query change isolation level , restore @ end of query - there chance isolation level may apply other queries?

i think not, want confirm.

sql server 2008 r2

and talking system.data.sqlclient.sqlconnection

loaded question, definitive answer impossible because @lassev.karlsen has stated sqlconnection not thread safe behavior going unpredictable. attempted similar scenarios in past , failed. here think happen parameters in question.

does sqlconnection processes queries in parallel?

no, not know how because wasn't designed task. though fact it's possible build process use in manner tempting.

will queries executed sequentially

yes. queries executed sql engine in order received. though connection object not know thread pass results , you'll dreaded 'object reference error'.

is there chance isolation level may apply other queries

yes. if change isolation level of transaction object assigned sqlconnection , 1 of threads attempts use connection have isolation level default. timing of when secondary thread out of control @ point. can assign transaction per command (and thereby attain unique isolation level desired) you'll still have issue of connection not being thread safe.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -