ADO vs Query Analyzer Performance -- It's not parameter sniffing



I'm running into an issue that I've seen in production and also reproduced
in a test environment:

1. Call to stored procedure from application via ADO takes a long time
2. Immediately calling the same stored procedure WITH SAME PARAMETERS from
Query Analyzer returns the results almost immediately.

I have tried multiple ways of narrowing this down and the only differences I
see are ADO/SQLOLEDB vs. Query Analyzer. Using SQL Profiler I captured
SP:Stmt Starting and SP:Stmt Completed and watched the individual queries
run (the stored proc returns multiple recordsets). When called from ADO
only the query lines that returned results had their performance slowed
down, the other statements were "normal". I was informed that the Duration
data column in profiler is the time from when the request is received until
the last row is retrieved, so interaction between the client (ADO/SQLOLEDB)
and the server can affect duration.

I have ruled out "parameter sniffing" since in testing and in production I
have captured a call to the proc in profiler, and copied and pasted the
exact call into Query Analyzer and executed it immediately and the Query
Analyzer call returned very quickly (40 seconds from app, 2 seconds in Query
Analyzer). I've even from the development environment re-run the IDENTICAL
query from the app over and over (same parameters) and it still runs slow so
its not a matter of caching on the server. (By the way, the slowness in the
app is completely narrowed down to the Recordset.Open call so its not other
app code).

The wierd thing is that this issue seems to come and go and does seem to be
affected by stuff outside of the client.

I don't expect a direct answer to my problem (I haven't provided enough
specific probably anyways), but what I do need to understand is how
ADO/SQLOLEDB interaction with SQL Server is different than Query Analyzer.
What kinds of things would be different on both the client side
(ADO/SQLOLEDB vs Query Analyzer) and the server side (how either of these
two causes SQL Server to function differently. Also what is the difference
between RPC calls and "batch" calls as far as performance goes? Can the RPC
subsystem (which I'm assuming is the OS subsystem and not something specific
to SQL server) have bottlenecks as well (I think I've eliminated this as the
cause in this specific example though) ?

If anyone can give insight into that, it would be greatly appreciated!

Thanks,
Mike




.



Relevant Pages

  • Re: Exception: The SqlTransaction has completed; it is no longer usabl
    ... > I hv encountered this exception 'The SqlTransaction has completed; ... returning around 9000 rows in a DataSet and back to the app. ... > When that exception is thrown, I tried running the same stored procedure ... > I was thinking if Query Analyzer can return data very quickly... ...
    (microsoft.public.dotnet.framework.adonet)
  • SQLOLEDB vs Query Analyzer performance (not parameter sniffing)
    ... Immediately calling the same stored procedure WITH SAME PARAMETERS from ... Query Analyzer returns the results almost immediately. ... Analyzer call returned very quickly (40 seconds from app, ... ADO/SQLOLEDB interaction with SQL Server is different than Query Analyzer. ...
    (microsoft.public.data.oledb)
  • Re: SQL2005 sys tables
    ... Maybe you don't have the SQL Editor toolbar open. ... You can also change the database context by using the USE statement in the ... SQL Server Documentation Team ... I mean in sql2000 query analyzer I can do the select statement against ...
    (microsoft.public.sqlserver.security)
  • RE: select during transaction**
    ... > in query analyzer I want to update ... beacuse sql server decide on clustered index scan, therefore this statement must wait on releasing locks made by UPDATE ... because sql server chose clustered index seek and it didn't touch/need ... the data locking by UPDATE from first window. ...
    (microsoft.public.sqlserver.programming)
  • Summing tables in a UDF
    ... developed in Sybase into a SQL Server UDF. ... to run call the function in Query Analyzer even though it ... declare rentrev integer; ... What UDF type do I need to recreate this in SQL Server? ...
    (microsoft.public.sqlserver.programming)