Well, I understand this is quite vague to ask how many db write connections should I make.
Still, I’m putting this question here, but in a different way. Lets say I’ve 10 tables which are independent of each other.
I mean writing into one table does not mandate writing into other. The can be written into any of the tables with equal probabilitites.
What factors should be taken in mind to decide how many write connecttions should I make to a DB. I want to create these connections (connection objects) in memory and use it whenever required.
Typically it shouldn’t matter much as long as you keep your database operations batched together.
Personally I have a
DBReadfunction that creates a connection, executes the SQL statement(s), gets aDataTable(C#) and closes the connection. It is typically called 3-8 times per page render, which isn’t that much considering I make heavy use of AJAX and client-side computing of data (little to no server side paging).This may be different if the database server is on another computer or even outside your network, as the latency times add up, but typically you should be fine just throwing them away and recreating them.