Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Performance in Microsoft SQL Server

Performance in Microsoft SQL Server

Scheduled Pinned Locked Moved Database
databasesql-serversysadminperformancetutorial
10 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mehdi Ghiasi
    wrote on last edited by
    #1

    Hello. I have opened a lot of cn.open() and cn.close() in my web application. for example when a page is loading, almost 10 connections are opened and closed. Whether it creates performance problems?

    Regards. Mehdi Ghiasi

    L B S P P 5 Replies Last reply
    0
    • M Mehdi Ghiasi

      Hello. I have opened a lot of cn.open() and cn.close() in my web application. for example when a page is loading, almost 10 connections are opened and closed. Whether it creates performance problems?

      Regards. Mehdi Ghiasi

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Mehdi Ghiasi wrote:

      Whether it creates performance problems?

      No, it doesn't. Opening a connection to a server that you have already connected to is fast. You could write a small application to test and verify my statement :)

      I are Troll :suss:

      M 1 Reply Last reply
      0
      • M Mehdi Ghiasi

        Hello. I have opened a lot of cn.open() and cn.close() in my web application. for example when a page is loading, almost 10 connections are opened and closed. Whether it creates performance problems?

        Regards. Mehdi Ghiasi

        B Offline
        B Offline
        basementman
        wrote on last edited by
        #3

        You would be much better off by using one connection and either returning multiple result sets from a stored procedure or using the MARS feature over a single connection.

        onwards and upwards...

        M 1 Reply Last reply
        0
        • M Mehdi Ghiasi

          Hello. I have opened a lot of cn.open() and cn.close() in my web application. for example when a page is loading, almost 10 connections are opened and closed. Whether it creates performance problems?

          Regards. Mehdi Ghiasi

          S Offline
          S Offline
          Simon_Whale
          wrote on last edited by
          #4

          I'd have a read of this MSDN Article: Connection Pooling[^] Also Connection pooling is turned on by default when using ADO.NET

          Nagy Vilmos wrote:

          And eat bacon. Bacon's real important for 'puters.

          modified on Thursday, May 5, 2011 5:01 PM

          1 Reply Last reply
          0
          • L Lost User

            Mehdi Ghiasi wrote:

            Whether it creates performance problems?

            No, it doesn't. Opening a connection to a server that you have already connected to is fast. You could write a small application to test and verify my statement :)

            I are Troll :suss:

            M Offline
            M Offline
            Mehdi Ghiasi
            wrote on last edited by
            #5

            My server and sql server are different. (server of microsoft sql server is not localhost. it is sql.something.com) So, isn't there any performance problem?

            Regards. Mehdi Ghiasi

            L 1 Reply Last reply
            0
            • B basementman

              You would be much better off by using one connection and either returning multiple result sets from a stored procedure or using the MARS feature over a single connection.

              onwards and upwards...

              M Offline
              M Offline
              Mehdi Ghiasi
              wrote on last edited by
              #6

              Where can I learn about this?!

              Regards. Mehdi Ghiasi

              W 1 Reply Last reply
              0
              • M Mehdi Ghiasi

                My server and sql server are different. (server of microsoft sql server is not localhost. it is sql.something.com) So, isn't there any performance problem?

                Regards. Mehdi Ghiasi

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Mehdi Ghiasi wrote:

                So, isn't there any performance problem?

                That depends on the network-card, the cabling and the amount of sunspots. Opening and closing a connection goes fast enough to simulate a file-system and open and close the connection on each operation that explorer requests. Simon's article on the ThreadPool explains how and why.

                I are Troll :suss:

                1 Reply Last reply
                0
                • M Mehdi Ghiasi

                  Where can I learn about this?!

                  Regards. Mehdi Ghiasi

                  W Offline
                  W Offline
                  wizardzz
                  wrote on last edited by
                  #8

                  I heard about this website called google.com. Apparently it has been around for a while and is very easy to use, but you should check for yourself. That's www.google.com

                  Craigslist Troll: litaly@comcast.net "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

                  1 Reply Last reply
                  0
                  • M Mehdi Ghiasi

                    Hello. I have opened a lot of cn.open() and cn.close() in my web application. for example when a page is loading, almost 10 connections are opened and closed. Whether it creates performance problems?

                    Regards. Mehdi Ghiasi

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #9

                    Mehdi Ghiasi wrote:

                    almost 10 connections

                    I hope you mean one connection is opened and closed almost ten times. If so, you might do better to open it once and close it at the end of the method.

                    1 Reply Last reply
                    0
                    • M Mehdi Ghiasi

                      Hello. I have opened a lot of cn.open() and cn.close() in my web application. for example when a page is loading, almost 10 connections are opened and closed. Whether it creates performance problems?

                      Regards. Mehdi Ghiasi

                      P Offline
                      P Offline
                      Prasanta_Prince
                      wrote on last edited by
                      #10

                      i think little bit issue will arise. If you instantiate an object for ten times or create ten object or some method of an object (like,- Open() and Close()) performance can be a issue . mostly its a bad programming practice.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups