Re: Very bad response time from stored procedure call via ADO



Craig wrote:
Hi,
We have a stored procedure that returns some statistical information
to a VB6 application for display via ADO. SQL Server is version 2000
SP4 and is clustered (2 nodes)

The stored procedure structure is as follows:

Create procedure upLstXYZ
( @Parm varchar(5)
)
as
begin
set nocount on

select 'Result col 1' as Heading, dbo.fn1(@Parm) as Value
union all
select 'Result col 2', dbo.fn2(@Parm)
union all
select 'Result col 3', dbo.fn3(@Parm)
union all
select 'Result col 4', dbo.fn4(@Parm)

end

In total there are 14 rows returned (14 function calls).

When run in SQL Query Analyser the typical duration is 400ms.

When run from the VB6 application via ADO the duration increases to
over 60000ms!

I've captured a profiler trace when the stored procedure is run via
ADO. The extra time is occurring in some of the function calls. The
duration is increased in the order of between 150 and 400 times!

In our development environment, which is not clustered, there is
neglible difference in reponse time between running the stored
procedure in SQL Query Analyser and the via ADO in the VB application.

What would you suggest I do to resolve this?

The usual culprit when there is a difference in performance between testing
a procedure in QA and using the procedure in production is a behavior called
"parameter sniffing". See:
http://tinyurl.com/h7aa
and
http://www.microsoft.com/technet/prodtechnol/sql/2005/recomp.mspx#EEAA

If this does not turn out to be the problem, then I suggest you post a repro
to m.p.sqlserver.programming. In the repro, include the DDL and sample data
required to allow someone to install the tables, prcs and functions on his
own server and test them (www.aspfaq.com/5006)

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


.



Relevant Pages

  • Re: Create Storedprocedure with VB6? Is this possible?
    ... VB6 and ADO no .NET ... can SQL Server Management Studio." ... Can VB6 create a stored procedure on the fly. ... something similar) exactly what you're sending to the db engine (via ADO), ...
    (microsoft.public.vb.database.ado)
  • Re: Very bad response time from stored procedure call via ADO
    ... Turn on the Show Query Plan and show statistics option in SQL Server ... VB6 application for display via ADO. ... The stored procedure structure is as follows: ...
    (microsoft.public.data.ado)
  • VB in a stored procedure
    ... Is it possible to use VB or VB.NET in a stored procedure? ... I can call a stored procedure using ADO or ADO.NET from VB or VB.NET, ... the SQL Server can use in the Stored Procedure? ... good example of how it is done I would be very grateful. ...
    (microsoft.public.sqlserver.programming)
  • Help with ADO stored procedure
    ... Access 2003, 2000 format, SQL Server 2000 ... I have a stored procedure that works perfectly in SQL Query Analyser. ...
    (microsoft.public.access.formscoding)
  • Re: SQL Server stored prcedures with output parameters
    ... the stored procedure below appears to consistently ... > moment) how ADO handles that. ... Parameter 1 had direction input ... Appending parameter value http://www.holdenweb.com/ ...
    (comp.lang.python)