Your opinion on optimal performance.

Results 1 to 2 of 2

Thread: Your opinion on optimal performance.

  1. #1
    Scott Jones Guest

    Default Your opinion on optimal performance.

    I&#039;m creating a web application and every page makes calls to a SQL Server97 DB.<BR><BR>*MOST* pages have a header include file which renders information pertinent to the current user. The rest of the page also hits the DB but extracts completely different information.<BR><BR>I&#039;m using Stored procedures to extract and manipulate the data - it being the optimal way of doing things - but my question now concerns the ASP that does the calling.<BR><BR>The header needs to make a call, but so does the main body of the page. Instead of putting the Command Object creation in the header AND the pages, I&#039;ve created it in the header and destroyed it at the end of the main page. But this raises several questions:<BR><BR>a. Opening the Command Object and then leaving it open for the extent of the page is not closing it as soon as I&#039;m done, but if we&#039;re talking about 50 lines of .asp or html, does that really matter? Is it a performance hit?<BR><BR>b. It would be more legible to opena dn close the Command Object in the include file (header) AND each page body, but I&#039;ve read that opening objects is time consuming. Should I lose legibility or would opening the object twice per page not actually be that bad?<BR><BR>c. Instead of using the same lines over and over and over, I&#039;ve created a function that OPENS the object, Executes a named stored procedure and then closes it - depending on what is passed as a param.<BR><BR>The question is: "Which is faster and more optimal?"<BR>Open Command<BR>Execute procedure<BR>Close Procedure<BR><BR>OR<BR><BR>Call Open Function<BR>Call Execute Function<BR>Call Close Function<BR><BR>I&#039;ve hit the stage where optimization is extremely important to me and I can&#039;t help but feel that there are always better ways of doing things, so your views are valued.

  2. #2
    Join Date
    Dec 1969

    Default Command object != Connection object

    A *command* has negligible overhead, a *connection*, however, does.<BR><BR>if it&#039;s a big page, use two connections, via OLEDB allowing for connection pooling. alternatively use just ONE connection in the header to get ALL the info into low overhead local variables, then write them when required.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts