[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.

Question
[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!

8.7

Stored procedure slow from VB.NET, fast from SSMS

Asked by gunman69 in MS SQL Server, .NET, Visual Basic Programming

Tags: SQL Server 2005, VB.NET, stored procedure, performance

I have an SP that takes 23 parameters, and the result set depends (of course) on the parameters.
In this particular scenario (i.e. with a specific set of values for the parameters) the SP returns 30 000 rows, with around 150 columns.

When I run the SP directly from the query window in SSMS, the SP executes at around 50 secs (completely, with output result in the result window). The "Reads" columns in the profiles states 1927431 reads.
When I execute the SP from VB.NET, it now takes more than 20 minutes, and the "Reads" column states a much greater value (unfortunately I don't have right now, but it's at least 100 times greater).

In VB.NET, I call ExecuteReader. For testing purposes, I have removed the code that iterates over the IDataReader which is returned. In other words, I dont pull much data from SQL Server to the VB.NET process (or at least that's the way I think it works).

The VB.NET executable lives on the same machine as SQL Server, whereas SSMS and SQL Server are on different machines (separated with a slow network)

Note that I THINK that the call from VB.NET sometimes executes at around the same time as from within SSMS (under a minute). I am not sure, since I haven't worked with this code for long myself.

Any ideas what can cause the performance difference?

Perhaps I am completely wrong, but to me it looks like SQL Server picks different execution plans, when I perform the call from SSMS v.s. when I call from VB.NET. (Because of the big difference in number of reads).

Thanks!
/Fredrik
[+][-]11/06/09 07:44 AM, ID: 25760056Accepted Solution

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

Zones: MS SQL Server, .NET, Visual Basic Programming
Tags: SQL Server 2005, VB.NET, stored procedure, performance
Sign Up Now!
Solution Provided By: emoreau
Participating Experts: 3
Solution Grade: A
 
[+][-]11/06/09 06:37 AM, ID: 25759423Expert Comment

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/06/09 07:20 AM, ID: 25759836Author Comment

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/06/09 07:46 AM, ID: 25760077Expert Comment

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/06/09 04:56 PM, ID: 25764423Author Comment

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/06/09 04:59 PM, ID: 25764436Author Comment

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/06/09 05:18 PM, ID: 25764504Expert Comment

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/06/09 05:33 PM, ID: 25764562Expert Comment

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/06/09 11:22 PM, ID: 25765298Author Comment

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/07/09 05:28 AM, ID: 25766238Expert Comment

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/07/09 08:33 AM, ID: 25766890Author Comment

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.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625