[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

11/02/2004 at 05:34AM PST, ID: 21191431
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

-1 RecordCount / Long script execution time

Asked by stesherlock in Active Server Pages (ASP)

Tags: asp, set

Hi all,

I've recently started working with a new piece of software written in ASP with a Microsoft SQL database on the backend. There's one page which pulls records from the DB through a stored procedure which is taking over 10 seconds to run. This is causing a problem for our users because they access the page frequently and it's really starting to slow things down now! When the stored procedure is run in ASP, it takes around 4.5 seconds (hence the timers). There is also some code to manually count the records in the rs if the recordcount is -1 (which it is) - this takes another 6-6.5 seconds (actually counting through all records, then refreshing the rs).

Does anyone know how I can speed this up? The SP and the ASP code are pasted below. Ideally, a slightly faster stored procedure along with a true recordcount property being returned would be a perfect solution (bringing execution time to somewhere in the region of 2 seconds) - although this is still slow, it would be significantly faster than our current solution. Of course, any ideas for speeding things up further would be hugely appreciated!

Thanks,

Steve

PS Extra points are being offered for this one because I'm after a quick solution!

<%
StartBlock4 = Timer

set spAList = Server.CreateObject("ADODB.Command")
spAList.ActiveConnection = MM_LeeNightingale_STRING
spAList.CommandText = "dbo.spA_List"
spAList.Parameters.Append spAList.CreateParameter("@RETURN_VALUE", 3, 4)
spAList.Parameters.Append spAList.CreateParameter("@U", 200, 1,50,spAList__U)
spAList.Parameters.Append spAList.CreateParameter("@T", 200, 1,50,spAList__T)
spAList.Parameters.Append spAList.CreateParameter("@C", 200, 1,50,spAList__C)
spAList.Parameters.Append spAList.CreateParameter("@P", 200, 1,50,spAList__P)
spAList.Parameters.Append spAList.CreateParameter("@G", 200, 1,50,spAList__G)
spAList.Parameters.Append spAList.CreateParameter("@FA", 200, 1,50,spAList__FA)
spAList.Parameters.Append spAList.CreateParameter("@FK", 200, 1,50,spAList__FK)
spAList.Parameters.Append spAList.CreateParameter("@FC", 200, 1,50,spAList__FC)
spAList.CommandType = 4
spAList.CommandTimeout = 0
spAList.Prepared = true
set rsAList = spAList.Execute()

rsAList_numRows = 0

Block4Time = Timer - StartBlock4

%>





CREATE PROCEDURE dbo.spA_List(@U nvarchar(50),
@T nvarchar(50),
@C nvarchar(50),
@P nvarchar(50),
@G nvarchar(50) = 0,
@FA nvarchar(50),
@FK nvarchar(50),
@FC nvarchar(50))
AS SELECT DISTINCT
                      dbo.AOrders.AID, dbo.AOrders.Username, dbo.AOrders.OrderDate, dbo.AOrders.OrderType, dbo.AOrders.JobDescription,
                      dbo.CustomerNotes.ACCOUNT_REF, dbo.qryCancelA.Cancelled, dbo.qryProceedA.Proceed, dbo.CustomerNotes.NAME
FROM         dbo.AOrders INNER JOIN
                      dbo.qryProceedA ON dbo.AOrders.AID = dbo.qryProceedA.AID INNER JOIN
                      dbo.qryCancelA ON dbo.AOrders.AID = dbo.qryCancelA.AID INNER JOIN
                      dbo.CustomerNotes ON dbo.AOrders.Client = dbo.CustomerNotes.ACCOUNT_REF LEFT OUTER JOIN
                      dbo.KOrders ON dbo.AOrders.AID = dbo.KOrders.AID
WHERE     (dbo.AOrders.Username LIKE @U) AND (dbo.qryProceedA.Proceed LIKE @P) AND (dbo.AOrders.OrderType LIKE @T) AND
                      (dbo.qryCancelA.Cancelled LIKE @C) AND (@G = 0) AND (dbo.AOrders.OrderType <> N'Composite') AND (dbo.AOrders.OrderType <> N'Consortium') AND
                       (CONVERT(nvarchar(50), dbo.AOrders.AID) LIKE @FA) AND (CONVERT(nvarchar(50), dbo.KOrders.KID) LIKE @FK) AND
                      (dbo.CustomerNotes.ACCOUNT_REF LIKE @FC) OR
                      (dbo.AOrders.Username LIKE @U) AND (dbo.qryProceedA.Proceed LIKE @P) AND (dbo.AOrders.OrderType LIKE @T) AND
                      (dbo.qryCancelA.Cancelled LIKE @C) AND (@G = 0) AND (dbo.AOrders.OrderType <> N'Composite') AND (dbo.AOrders.OrderType <> N'Consortium') AND
                       (CONVERT(nvarchar(50), dbo.AOrders.AID) LIKE @FA) AND (CONVERT(nvarchar(50), dbo.KOrders.KID) IS NULL) AND
                      (dbo.CustomerNotes.ACCOUNT_REF LIKE @FC) AND (@FK = '%') OR
                      (dbo.AOrders.Username LIKE @U) AND (dbo.qryProceedA.Proceed LIKE @P) AND (dbo.AOrders.OrderType LIKE @T) AND
                      (dbo.qryCancelA.Cancelled LIKE @C) AND (@G = 1) AND (dbo.AOrders.OrderType <> N'Composite') AND (dbo.AOrders.OrderType <> N'Legal') AND
                      (CONVERT(nvarchar(50), dbo.AOrders.AID) LIKE @FA) AND (CONVERT(nvarchar(50), dbo.KOrders.KID) LIKE @FK) AND
                      (dbo.CustomerNotes.ACCOUNT_REF LIKE @FC) AND (dbo.AOrders.OrderType <> N'Recruitment') AND (dbo.AOrders.OrderType <> N'Web') AND
                      (dbo.AOrders.OrderType <> N'Creative') AND (dbo.AOrders.OrderType <> N'Consortium') OR
                      (dbo.AOrders.Username LIKE @U) AND (dbo.qryProceedA.Proceed LIKE @P) AND (dbo.AOrders.OrderType LIKE @T) AND
                      (dbo.qryCancelA.Cancelled LIKE @C) AND (@G = 1) AND (dbo.AOrders.OrderType <> N'Composite') AND (dbo.AOrders.OrderType <> N'Legal') AND
                      (CONVERT(nvarchar(50), dbo.AOrders.AID) LIKE @FA) AND (CONVERT(nvarchar(50), dbo.KOrders.KID) IS NULL) AND
                      (dbo.CustomerNotes.ACCOUNT_REF LIKE @FC) AND (@FK = '%') AND (dbo.AOrders.OrderType <> N'Recruitment') AND
                      (dbo.AOrders.OrderType <> N'Web') AND (dbo.AOrders.OrderType <> N'Creative') AND (dbo.AOrders.OrderType <> N'Consortium')
ORDER BY dbo.AOrders.OrderDate DESC

GO
[+][-]11/02/04 06:08 AM, ID: 12472684

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/02/04 06:19 AM, ID: 12472776

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/02/04 07:40 AM, ID: 12473693

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/02/04 08:18 AM, ID: 12474130

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/02/04 08:45 AM, ID: 12474388

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/02/04 09:11 AM, ID: 12474724

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Active Server Pages (ASP)
Tags: asp, set
Sign Up Now!
Solution Provided By: Hilaire
Participating Experts: 1
Solution Grade: A
 
 
[+][-]11/09/04 08:52 AM, ID: 12535309

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/04 09:01 AM, ID: 12535424

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/04 09:13 AM, ID: 12535557

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/04 09:14 AM, ID: 12535580

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91