Question:
Is it slower to close and open a SQL Server connection instead of keeping it open?
anonymous
2009-11-12 11:03:30 UTC
Hi! I'm developing an application with VB.NET which will be connecting to a SQL Server database, no other application will be connected to the database so I've got the following question: How will it be faster: closing and opening a connection when needed or keeping the connection open? I know that when many users connect the first option is better but since It will be only one user, which option is the best one?
Thanks and blessings since now!
Three answers:
?
2009-11-15 19:21:17 UTC
Hi,



What is the latency between the app server and the database? If the two servers are connected together on the same 100Mbps or better switch, you'll do fine with the non-persistent connection. However, if your app server is in one data center and the other elsewhere consider using a persistent connection.



Regards

joe@unixy.net

Fully Managed Dedicated Servers and Virtual Machines - http://www.unixy.net
Scott
2009-11-13 09:12:49 UTC
Opening connections to any database is one of the most expensive operations you do. It's part of the reason people started doing 'connection pooling'.



But if there is only one user, and that is how it will be forever, I don't see much point in keeping it open.



But if, in the future, this app will grow by users or traffic or volume, you'd want to plan for that. I've worked on apps that started in MSAccess for a team of 5, and ended up getting ported to Sql Svr for 100's!
?
2017-01-09 23:15:33 UTC
at the start, there's a brilliant distinction between listening to and listening. you may hear extra smart in case you close up your eyes and eliminate any seen distractions. you pays attention extra smart if your eyes are open in view which you will discover expressions, tears, smiles and word physique language that may regularly say better than words do.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...