Re: Any way to avoid using SP_EXECUTESQL in ADO.NET?
- From: "Brad P" <bradp@xxxxxx>
- Date: 13 Jul 2006 15:02:32 -0700
Thanks for the response,
When we run the queries in Query Analyzer we are directly inserting the
parameter values into the query. From what I can tell, the parameter
values themselves are typical for the data we are working with. Does
SP_EXECUTESQL use statistics differently than running the raw query in
Query Analyzer?
Thanks,
Brad P.
David Browne wrote:
"Brad P" <bradp@xxxxxx> wrote in message
news:1152818503.486755.310220@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
Our development team has encountered some performance problems when
using ADO.NET (using the SqlCommand and SqlDataAdapter objects) to
perform queries on large data tables. We've drilled into the issue
considerably, and the problem seems to be related to how ADO.NET uses
the SP_EXECUTESQL when running text queries. I say this because when we
run our query in Query Analyzer by itself the performance is less than
a second, but when running it with the SP_EXECUTESQL command (which is
what Profiler is telling us is being used), it takes nearly half a
minute.
. . .
It is unlikely that SP_EXECUTESQL is the real cause of your problem. It is
more likely that you are getting a sub-opitmal execution plan when running
SP_EXECUTESQL because of the different amount of statistical evidence
available to the optimizer.
When you run the queries in Query Analyzer are you using local variables and
parameter markers the same way SP_EXECUTESQL is? What are the parameter
values passed, and are they statistically typical or atypical?
David
.
- Follow-Ups:
- Re: Any way to avoid using SP_EXECUTESQL in ADO.NET?
- From: David Browne
- Re: Any way to avoid using SP_EXECUTESQL in ADO.NET?
- References:
- Any way to avoid using SP_EXECUTESQL in ADO.NET?
- From: Brad P
- Re: Any way to avoid using SP_EXECUTESQL in ADO.NET?
- From: David Browne
- Any way to avoid using SP_EXECUTESQL in ADO.NET?
- Prev by Date: Re: SQL Server Authentication versus Windows Authentication
- Next by Date: Re: SQL Server Authentication versus Windows Authentication
- Previous by thread: Re: Any way to avoid using SP_EXECUTESQL in ADO.NET?
- Next by thread: Re: Any way to avoid using SP_EXECUTESQL in ADO.NET?
- Index(es):
Relevant Pages
|