473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Horrible performance when executing stored procedure

When I execute a stored procedure with the following code it takes
forever and result in a timeout or a hang:

Sub TransformData()
Dim myConnection As New SqlConnection(ConnectionString)
Dim myCommand As New SqlCommand("spImport_amount_transform",
myConnection)
myCommand.CommandType = CommandType.StoredProcedure

myCommand.CommandTimeout = 3600
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub

When I execute the same stored procedure through the Enterprise Manager
it takes less than a second.

What could be wrong and how should I start troubleshooting?

Regards,

SE

Nov 8 '06 #1
2 1453
that's odd.

I'd use SQL Profiler and try to see what's going on.

If you spend all your time executing spImport_amount_transform, then it's
still something to do with the sproc. Maybe when you were executing it from
EM, SQL Server had cached the tables/index/data. Otherwise, SQL Profiler
will show you authentication audits and all that so maybe it's something
wrong with that.

It's very hard to do ad hoc testing of SQL. I've had queries take 1 minute
to run, then I run them again and they take 2 seconds. SQL Server caches
aggresively and in development, when there isn't much activity, it tends to
make things act all bonkers as far as performance (i.e., things run a lot
faster than they should).

Karl
--
http://www.openmymind.net/
http://www.codebetter.com/
<st****@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
When I execute a stored procedure with the following code it takes
forever and result in a timeout or a hang:

Sub TransformData()
Dim myConnection As New SqlConnection(ConnectionString)
Dim myCommand As New SqlCommand("spImport_amount_transform",
myConnection)
myCommand.CommandType = CommandType.StoredProcedure

myCommand.CommandTimeout = 3600
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub

When I execute the same stored procedure through the Enterprise Manager
it takes less than a second.

What could be wrong and how should I start troubleshooting?

Regards,

SE

Nov 8 '06 #2
this will be a query plan problem. generally when you get a difference like
this its a difference in settings (quoted identifier, ascii nulls, etc).

a sql profile will tell yo the settings asp.net is using. then run the
trace, you should see the same performance in QA. then you can correct it.

-- bruce (sqlwork.com)
<st****@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
When I execute a stored procedure with the following code it takes
forever and result in a timeout or a hang:

Sub TransformData()
Dim myConnection As New SqlConnection(ConnectionString)
Dim myCommand As New SqlCommand("spImport_amount_transform",
myConnection)
myCommand.CommandType = CommandType.StoredProcedure

myCommand.CommandTimeout = 3600
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub

When I execute the same stored procedure through the Enterprise Manager
it takes less than a second.

What could be wrong and how should I start troubleshooting?

Regards,

SE

Nov 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: agherring | last post by:
Hi, We've just started evaluating the Data Direct ODBC Oracle driver and comparing performance with Oracle's own driver in a development project we're undertaking. We have struck a problem -...
5
by: Warren Wright | last post by:
Hi group, I have a select statement that if run against a 1 million record database directly in query analyzer takes less than 1 second. However, if I execute the select statement in a stored...
17
by: Felix | last post by:
Dear Sql Server experts: First off, I am no sql server expert :) A few months ago I put a database into a production environment. Recently, It was brought to my attention that a particular...
12
by: serge | last post by:
I have an SP that is big, huge, 700-800 lines. I am not an expert but I need to figure out every possible way that I can improve the performance speed of this SP. In the next couple of weeks I...
3
by: Vagif Abilov | last post by:
Hello, I have a question regarding stored procedure desing that provides the optimal performance. Let's say we have a table Products that consists of three columns: Name, Status,...
7
by: andrew | last post by:
Does anyone know if there are any plans to address SQLprocedures() API performance in UDB 8.1 client/server? 8.1 SQLprocedures() API call is implemented through SYSIBM.SQLPROCEDURES(?,?,?,?)...
4
by: Vadivel Kumar | last post by:
Hi Guys, I have a doubt which is little bit conceptual rather than a coding convention. I have a a table called products in which I have 40000 and odd products which is expected to be...
9
by: Frank | last post by:
Hi, imagine there's a WEB application reading data from an Oracle database to visualize in using DataGrids in the clients browser. Yes, sounds simple, just create OracleConnection + OracleCommand...
2
by: mariuszb | last post by:
I use job executing stored procedures to get data for OLAP. All works fine except one thing: one of the procedures takes a few hours to complete. Executing procedure via remote desktop and query...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.