I would like to add that delaying the connection acquistion until the first statement needs to be executed has another highly interesting advantage: if the transactional method can produce its results from the L2 and/or query caches, it does not need to hit the database at all, whereas acquiring the connection at the beginning and holding it until the end both consumes unnecessary connection resources, and requires extra network roundtrips to the database. The performance difference in applications with well-tuned caches could be dramatical. |