Showing posts with label intermittently. Show all posts
Showing posts with label intermittently. Show all posts

Friday, March 30, 2012

Intermittently Slow query - Left Join

Here's a little background on the query. I have a list of documents by an id number in one table and the description of the sheets in another table. It's a one to many relationship, so for each description, there may be multiple entries in the documents table that it applies to. For example:

Descriptions table:

ID | Title
Doc1 | Document 1
Doc2 | Document 2

Documents table:

ID | Parent
Doc1 | 10400
Doc2 | 10400
Doc1 | 20189
Doc3 | 20189

View:

ID | Parent | Description
Doc1 | 10400 | Document 1
Doc2 | 10400 | Document 2
Doc1 | 20189 | Document 1
Doc3 | 20189 | (null)

So the query I am using uses a left join to combine the data from the one table into the other. There might not be an entry for the description, so for some Document entries, the description field may be blank. For some reason, certain queries take about 2 minutes longer than others who retreive 5 times the information.

In SQL Manager, is says "Executing Query. Waiting for response from data source." After about 20 seconds it says "Retrieving Data..." then about a minute later, it finally comes up with the data. I can select another parent that has a lot more items and it comes up in about 3 seconds max.

It's running on SQL Server 2005 with 2GB of RAM.

Any suggestions on tracking down the reason for the slowness would be great.

Thanks in advance!!!

-DanPost the query you are executing.|||SELECT
dbo.Table1.ItemType,
dbo.Table1.ItemLabel,
dbo.Table1.ItemParent,
dbo.Table1.ItemID,
dbo.Table1.ProjectID,
dbo.Table1.ItemDate,
dbo.Table1.Active,
dbo.Table1.ItemBaseLabel,
dbo.Table2.ItemDescription
FROM dbo.Table1 LEFT OUTER JOIN dbo.Table2
ON dbo.Table1.ProjectID = dbo.Table2.ProjectID
AND dbo.Table1.ItemBaseLabel = dbo.Table2.ItemBaseLabel

Here you go!

-Dan|||where are the indices placed? have you looked at the execution plan?|||That's weird... I just checked the indices on the base table and there are three. One is By ItemID. Another is by ItemLabel and another is by ItemLabel, ItemParent, Item ID, and another field. Could they be throwing off the way the data is being stored?

There are no indices on the view and I cannot add one. It comes up with an error saying that it can't add an index because it's not schema based. Please, bear with me - I'm new to 2005. This was originally stored on MSSQL 7.0 and it worked fine there.

Thanks!

-Dan|||typically you want indices on search conditions, primary keys (there is usually a clustered one there) and the foriegn keys but you should examine the execution plan first to make sure this will help. if they are already there, make sure they are not fragmented, the statistics are up to date, and then if this is a sp, recompile it. I am not working with 2K5 just yet.|||I checked the indices and everything seems to be in order. I also tried it through a stored procedure and it still takes way too long.

Any other ideas?

-Dan|||for the third time... have you looked at the execution plan?|||Sorry. The execution plan said that a table scan on the dbo.Table2 was 100% cost. So I looked at the fields it was referencing and added a column to the Table2 index and then re-ran the execution plan and it was more divided among the tasks, now with 2 index scans.

Went back to the query and now it's blazing fast.

Apparently my listening skills are about as good as my databasing skills...

Thanks Thrasymachus. :)

-Dan

intermittently my SSIS Packages which are run through the JOB are failing

Hi SSIS Guru's,

I am facing a very strange problem.

We have 2 Physical Servers (A and B) on which we have installed the SQL Server, one primary (A) and other as secondary (B). And there is a cluster (C) available to acces the running server. I have created some SSIS packages which we installed on the Server A (Primary), and created the job on the cluster server which initiates the SSIS packages, whcih are installed in the File System.

The problem i am facing is the some thing related to Connection time out. And interestingly i am not getting this error Always. Approxiamtely For Every 5 Times once it;s Failing. I am copying the errors Which i encountered in the different runs.

The thing i am confused is why i am not geting the error all the time? And Why am i getting this error all the time in a different data flow task. My SSIS Package structure is I have created one master package and 6 Child packages. I am getting the connection string for the Data base from the Configuration file which is defined in the XML File.

The connection string that i am using is

Data Source=<<server name>>;User ID=DOMAIN\user;Initial Catalog=DatabaseName;Provider=SQLNCLI.1;Integrated Security=SSPI;

*************************************************************************************************************************************

RUN 1 - Error
Executed as user: AMR\sys_calyp. ...sion 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights

reserved. Started: 2:00:07 PM Error: 2007-09-15 14:02:35.92 Code: 0xC0202009 Source: ssis_emp Connection manager

"DBCONNECTION" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An

OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Unable to complete

login process due to delay in opening server connection". End Error Error: 2007-09-15 14:02:35.92 Code: 0xC020801C

Source: infr_char Get the Records from emp 1 [72] Description: SSIS Error Code

DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager

"DBCONNECTION" failed with error code 0xC0202009. There may be error messages posted before this with more information on

why the AcquireConnection method... The package execution fa... The step failed.

*************************************************************************************************************************************

*************************************************************************************************************************************

RUN 2 - Error
Message
Executed as user: AMR\sys_calyp. ...sion 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights

reserved. Started: 9:15:01 AM Error: 2007-09-15 09:17:01.64 Code: 0xC0202009 Source: ssis_emp Connection manager

"DBCONNECTION" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An

OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Unable to complete

login process due to delay in opening server connection". End Error Error: 2007-09-15 09:17:01.64 Code: 0xC020801C

Source: Data Flow Task Get the Records from emp [473] Description: SSIS Error Code

DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager

"DBCONNECTION" failed with error code 0xC0202009. There may be error messages posted before this with more information on

why the AcquireConnection me... The package execution fa... The step failed.

*************************************************************************************************************************************

*************************************************************************************************************************************

Run -3 Error
Message
Executed as user: AMR\sys_calyp. ...sion 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights

reserved. Started: 11:30:01 PM Error: 2007-09-14 23:32:21.28 Code: 0xC0202009 Source: ssis_dept Connection

manager "DBCONNECTION" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code:

0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Unable

to complete login process due to delay in opening server connection". End Error Error: 2007-09-14 23:32:21.28 Code:

0xC020801C Source: Data Flow Task Get the Records from dept [632] Description: SSIS Error Code

DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager

"DBCONNECTION" failed with error code 0xC0202009. There may be error messages posted before this with more information on

why the AcquireConnection method ... The package execution fa... The step failed.

*************************************************************************************************************************************

*************************************************************************************************************************************

Run - 4 Error

Message
Executed as user: AMR\sys_calyp. ...sion 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights

reserved. Started: 11:00:02 PM Error: 2007-09-14 23:02:21.46 Code: 0xC0202009 Source: ssis_emp Connection

manager "DBCONNECTION" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code:

0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Unable

to complete login process due to delay in opening server connection". End Error Error: 2007-09-14 23:02:21.46 Code:

0xC020801C Source: infr_itm_char_val Get the Records from emp_master [1] Description: SSIS Error Code

DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager

"DBCONNECTION" failed with error code 0xC0202009. There may be error messages posted before this with more information on

why the AcquireCon... The package execution fa... The step failed.

*************************************************************************************************************************************

*************************************************************************************************************************************

Run -5 Error

Message
Executed as user: AMR\sys_calyp. ...Execute Package Utility Version 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp

1984-2005. All rights reserved. Started: 9:10:59 PM Error: 2007-09-14 21:12:23.25 Code: 0xC0202009 Source:

ssis_salgrade Connection manager "DBCONNECTION" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred.

Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005

Description: "Unable to complete login process due to delay in opening server connection". End Error Error: 2007-09-14

21:12:23.25 Code: 0xC020801C Source: Data Flow Task - ssis_salgrade get salgrade [3227] Description: SSIS Error

Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager

"DBCONNECTION" failed with error code 0xC0202009. There may be error messages posted before this with more information on

why the AcquireConnection method c. The step failed.

*************************************************************************************************************************************

I thought i found the solution my self... I changed the delay validation to all the packages to true and the problem dissappeared Smile

intermittently my SSIS Packages which are run through the JOB are failing

Hi SSIS Guru's,

I am facing a very strange problem.

We have 2 Physical Servers (A and B) on which we have installed the SQL Server, one primary (A) and other as secondary (B). And there is a cluster (C) available to acces the running server. I have created some SSIS packages which we installed on the Server A (Primary), and created the job on the cluster server which initiates the SSIS packages, whcih are installed in the File System.

The problem i am facing is the some thing related to Connection time out. And interestingly i am not getting this error Always. Approxiamtely For Every 5 Times once it;s Failing. I am copying the errors Which i encountered in the different runs.

The thing i am confused is why i am not geting the error all the time? And Why am i getting this error all the time in a different data flow task. My SSIS Package structure is I have created one master package and 6 Child packages. I am getting the connection string for the Data base from the Configuration file which is defined in the XML File.

The connection string that i am using is

Data Source=<<server name>>;User ID=DOMAIN\user;Initial Catalog=DatabaseName;Provider=SQLNCLI.1;Integrated Security=SSPI;

*************************************************************************************************************************************

RUN 1 - Error
Executed as user: AMR\sys_calyp. ...sion 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights

reserved. Started: 2:00:07 PM Error: 2007-09-15 14:02:35.92 Code: 0xC0202009 Source: ssis_emp Connection manager

"DBCONNECTION" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An

OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Unable to complete

login process due to delay in opening server connection". End Error Error: 2007-09-15 14:02:35.92 Code: 0xC020801C

Source: infr_char Get the Records from emp 1 [72] Description: SSIS Error Code

DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager

"DBCONNECTION" failed with error code 0xC0202009. There may be error messages posted before this with more information on

why the AcquireConnection method... The package execution fa... The step failed.

*************************************************************************************************************************************

*************************************************************************************************************************************

RUN 2 - Error
Message
Executed as user: AMR\sys_calyp. ...sion 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights

reserved. Started: 9:15:01 AM Error: 2007-09-15 09:17:01.64 Code: 0xC0202009 Source: ssis_emp Connection manager

"DBCONNECTION" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An

OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Unable to complete

login process due to delay in opening server connection". End Error Error: 2007-09-15 09:17:01.64 Code: 0xC020801C

Source: Data Flow Task Get the Records from emp [473] Description: SSIS Error Code

DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager

"DBCONNECTION" failed with error code 0xC0202009. There may be error messages posted before this with more information on

why the AcquireConnection me... The package execution fa... The step failed.

*************************************************************************************************************************************

*************************************************************************************************************************************

Run -3 Error
Message
Executed as user: AMR\sys_calyp. ...sion 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights

reserved. Started: 11:30:01 PM Error: 2007-09-14 23:32:21.28 Code: 0xC0202009 Source: ssis_dept Connection

manager "DBCONNECTION" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code:

0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Unable

to complete login process due to delay in opening server connection". End Error Error: 2007-09-14 23:32:21.28 Code:

0xC020801C Source: Data Flow Task Get the Records from dept [632] Description: SSIS Error Code

DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager

"DBCONNECTION" failed with error code 0xC0202009. There may be error messages posted before this with more information on

why the AcquireConnection method ... The package execution fa... The step failed.

*************************************************************************************************************************************

*************************************************************************************************************************************

Run - 4 Error

Message
Executed as user: AMR\sys_calyp. ...sion 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights

reserved. Started: 11:00:02 PM Error: 2007-09-14 23:02:21.46 Code: 0xC0202009 Source: ssis_emp Connection

manager "DBCONNECTION" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code:

0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Unable

to complete login process due to delay in opening server connection". End Error Error: 2007-09-14 23:02:21.46 Code:

0xC020801C Source: infr_itm_char_val Get the Records from emp_master [1] Description: SSIS Error Code

DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager

"DBCONNECTION" failed with error code 0xC0202009. There may be error messages posted before this with more information on

why the AcquireCon... The package execution fa... The step failed.

*************************************************************************************************************************************

*************************************************************************************************************************************

Run -5 Error

Message
Executed as user: AMR\sys_calyp. ...Execute Package Utility Version 9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp

1984-2005. All rights reserved. Started: 9:10:59 PM Error: 2007-09-14 21:12:23.25 Code: 0xC0202009 Source:

ssis_salgrade Connection manager "DBCONNECTION" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred.

Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005

Description: "Unable to complete login process due to delay in opening server connection". End Error Error: 2007-09-14

21:12:23.25 Code: 0xC020801C Source: Data Flow Task - ssis_salgrade get salgrade [3227] Description: SSIS Error

Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager

"DBCONNECTION" failed with error code 0xC0202009. There may be error messages posted before this with more information on

why the AcquireConnection method c. The step failed.

*************************************************************************************************************************************

I thought i found the solution my self... I changed the delay validation to all the packages to true and the problem dissappeared Smile

intermittent SQL Server does not exist or access denied

Hi,
We seperated out our web server (IIS) from our SQL Server recently. Things
have gone well, except one thing. Intermittently, we get the message "SQL
Server does not exist or access denied" when users try to get to the site.
The two machines are connected via a 1GBps direct connection. We've seen
high usage of that connection at times when this has happened, but not
always. Does anyone have any ideas?
Here's the connection string...
"Provider=SQLOLEDB;User ID=our_db_user;Initial
Catalog=our_db;Network=DBMSSOCN;Address=192.168.0.1,1433;Password=our_passwo
rd"
Thanks in advance.
JoshNo one has any ideas?
"Josh Knepfle" <josh@.sparkpeople.com> wrote in message
news:rGWjb.75792$uJ2.12329@.fe3.columbus.rr.com...
> Hi,
> We seperated out our web server (IIS) from our SQL Server recently.
Things
> have gone well, except one thing. Intermittently, we get the message
"SQL
> Server does not exist or access denied" when users try to get to the site.
> The two machines are connected via a 1GBps direct connection. We've seen
> high usage of that connection at times when this has happened, but not
> always. Does anyone have any ideas?
> Here's the connection string...
> "Provider=SQLOLEDB;User ID=our_db_user;Initial
>
Catalog=our_db;Network=DBMSSOCN;Address=192.168.0.1,1433;Password=our_passwo
> rd"
> Thanks in advance.
> Josh
>|||Try the following troubleshooting article:
INF: Potential Causes of the "SQL Server Does Not Exist or
Access Denied" Error Message
http://support.microsoft.com/?id=328306
-Sue
On Wed, 22 Oct 2003 14:15:26 GMT, "Josh Knepfle"
<josh@.sparkpeople.com> wrote:
>No one has any ideas?
>"Josh Knepfle" <josh@.sparkpeople.com> wrote in message
>news:rGWjb.75792$uJ2.12329@.fe3.columbus.rr.com...
>> Hi,
>> We seperated out our web server (IIS) from our SQL Server recently.
>Things
>> have gone well, except one thing. Intermittently, we get the message
>"SQL
>> Server does not exist or access denied" when users try to get to the site.
>> The two machines are connected via a 1GBps direct connection. We've seen
>> high usage of that connection at times when this has happened, but not
>> always. Does anyone have any ideas?
>> Here's the connection string...
>> "Provider=SQLOLEDB;User ID=our_db_user;Initial
>Catalog=our_db;Network=DBMSSOCN;Address=192.168.0.1,1433;Password=our_passwo
>> rd"
>> Thanks in advance.
>> Josh
>>
>|||Thanks for the info, Sue.
I think most of those are for cases where you can't EVER connect.
Unfortunately, ours is only intermittant. It seems like the number of
connections jumps up when it happens, too. Any thoughts?
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:1bbdpv0fav02hrlbqum3lg8m17la8frpva@.4ax.com...
> Try the following troubleshooting article:
> INF: Potential Causes of the "SQL Server Does Not Exist or
> Access Denied" Error Message
> http://support.microsoft.com/?id=328306
> -Sue
> On Wed, 22 Oct 2003 14:15:26 GMT, "Josh Knepfle"
> <josh@.sparkpeople.com> wrote:
> >No one has any ideas?
> >
> >"Josh Knepfle" <josh@.sparkpeople.com> wrote in message
> >news:rGWjb.75792$uJ2.12329@.fe3.columbus.rr.com...
> >> Hi,
> >>
> >> We seperated out our web server (IIS) from our SQL Server recently.
> >Things
> >> have gone well, except one thing. Intermittently, we get the message
> >"SQL
> >> Server does not exist or access denied" when users try to get to the
site.
> >> The two machines are connected via a 1GBps direct connection. We've
seen
> >> high usage of that connection at times when this has happened, but not
> >> always. Does anyone have any ideas?
> >>
> >> Here's the connection string...
> >> "Provider=SQLOLEDB;User ID=our_db_user;Initial
> >>
>Catalog=our_db;Network=DBMSSOCN;Address=192.168.0.1,1433;Password=our_passw
o
> >> rd"
> >>
> >> Thanks in advance.
> >> Josh
> >>
> >>
> >
>|||You can still have intermittent problems with some of the
network related issues sited in the article. You may also
want to check the Windows event logs on both servers for any
network related issues.
-Sue
On Thu, 23 Oct 2003 14:42:31 GMT, "Josh Knepfle"
<josh@.sparkpeople.com> wrote:
>Thanks for the info, Sue.
>I think most of those are for cases where you can't EVER connect.
>Unfortunately, ours is only intermittant. It seems like the number of
>connections jumps up when it happens, too. Any thoughts?
>"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
>news:1bbdpv0fav02hrlbqum3lg8m17la8frpva@.4ax.com...
>> Try the following troubleshooting article:
>> INF: Potential Causes of the "SQL Server Does Not Exist or
>> Access Denied" Error Message
>> http://support.microsoft.com/?id=328306
>> -Sue
>> On Wed, 22 Oct 2003 14:15:26 GMT, "Josh Knepfle"
>> <josh@.sparkpeople.com> wrote:
>> >No one has any ideas?
>> >
>> >"Josh Knepfle" <josh@.sparkpeople.com> wrote in message
>> >news:rGWjb.75792$uJ2.12329@.fe3.columbus.rr.com...
>> >> Hi,
>> >>
>> >> We seperated out our web server (IIS) from our SQL Server recently.
>> >Things
>> >> have gone well, except one thing. Intermittently, we get the message
>> >"SQL
>> >> Server does not exist or access denied" when users try to get to the
>site.
>> >> The two machines are connected via a 1GBps direct connection. We've
>seen
>> >> high usage of that connection at times when this has happened, but not
>> >> always. Does anyone have any ideas?
>> >>
>> >> Here's the connection string...
>> >> "Provider=SQLOLEDB;User ID=our_db_user;Initial
>> >>
>>Catalog=our_db;Network=DBMSSOCN;Address=192.168.0.1,1433;Password=our_passw
>o
>> >> rd"
>> >>
>> >> Thanks in advance.
>> >> Josh
>> >>
>> >>
>> >
>sql

Wednesday, March 28, 2012

Intermittent Performance Issue

I am having a severe performance issue with a procedure, but it only happens
intermittently so it's difficult to track down. The procedure is too
complex to include in this post because it uses nested views with lots of
tables etc. Basically it does this:
1. create temp table 1 (fast)
2. insert query result into table 1 (100 lines or so)
3. create temp table 2
4. query temp table 1 and insert results into table 2
5. query temp table 1 again (different summary) and insert results into
table 2
6. query temp table 1 again (different summary) and insert results into
table 2
7. query temp table 1 again (different summary) and insert results into
table 2
8. update temp table 2
9. select * from temp table 2 as output from procedure
Normally it runs very fast (a couple of seconds). When it's slow, it takes
30 - 150 seconds even though it's only dealing with a hundred lines or so.
Most of the time is consumed by lines 4 and 8 (about half and half). The
real mystery is line 4. It's only dealing with 100 lines and it sometimes
takes a minute! It is always very fast or very slow.
Yesterday when I investigated it I found that the C drive, which contained
SQL Server, my main database and the temp database, was nearly full. So I
moved the databases to the D and E drives with lots of space and freed up a
bunch of space on C. But the problem continues today.
When testing, I can run the procedure over and over again, but it always
finishes in a couple of seconds. When I try to display an estimated
execution plan, it gives me "Invalid object name" errors on two of my temp
tables. How can I debug it?
Is this type of performance problem (and inability to debug) caused by the
use of temp tables? If so, I could rewrite it not to use them, but it will
require several UNIONS of similar queries, which seemed to me would take
longer.
I tried setting the transaction isolation level to "READ UNCOMMITTED" in
case the problem was somehow caused by blocking, but that didn't make any
difference.
Rick.It sounds like you may have disk or cpu bottlenecks but that's not a lot to
go on. Try running perfmon to see if you can spot what the disk and
processor queues are like when it's happening. You might also try using a
table variable instead of a temp table and see if it makes a difference.
--
Andrew J. Kelly
SQL Server MVP
"Rick Harrrison" <rick@.knowware.com> wrote in message
news:eJOY1Ze4DHA.1636@.TK2MSFTNGP12.phx.gbl...
> I am having a severe performance issue with a procedure, but it only
happens
> intermittently so it's difficult to track down. The procedure is too
> complex to include in this post because it uses nested views with lots of
> tables etc. Basically it does this:
> 1. create temp table 1 (fast)
> 2. insert query result into table 1 (100 lines or so)
> 3. create temp table 2
> 4. query temp table 1 and insert results into table 2
> 5. query temp table 1 again (different summary) and insert results
into
> table 2
> 6. query temp table 1 again (different summary) and insert results
into
> table 2
> 7. query temp table 1 again (different summary) and insert results
into
> table 2
> 8. update temp table 2
> 9. select * from temp table 2 as output from procedure
> Normally it runs very fast (a couple of seconds). When it's slow, it
takes
> 30 - 150 seconds even though it's only dealing with a hundred lines or so.
> Most of the time is consumed by lines 4 and 8 (about half and half). The
> real mystery is line 4. It's only dealing with 100 lines and it sometimes
> takes a minute! It is always very fast or very slow.
> Yesterday when I investigated it I found that the C drive, which contained
> SQL Server, my main database and the temp database, was nearly full. So I
> moved the databases to the D and E drives with lots of space and freed up
a
> bunch of space on C. But the problem continues today.
> When testing, I can run the procedure over and over again, but it always
> finishes in a couple of seconds. When I try to display an estimated
> execution plan, it gives me "Invalid object name" errors on two of my temp
> tables. How can I debug it?
> Is this type of performance problem (and inability to debug) caused by the
> use of temp tables? If so, I could rewrite it not to use them, but it
will
> require several UNIONS of similar queries, which seemed to me would take
> longer.
> I tried setting the transaction isolation level to "READ UNCOMMITTED" in
> case the problem was somehow caused by blocking, but that didn't make any
> difference.
> Rick.
>|||to see the estimated execution plan
first create the temp tables, then use display est. ..
(from same session)
or use show execution plan, which runs the query and shows
the execution plan
if you don't like the above, do as andrew suggested and
switch to table variables.
also, on the test system, run profiler, capturing
SP:Recompile, see how times your sp recompiles during
execution,
recompile set points in the advent of inserts to temp
tables are 6 rows, 500 rows, and every 20%.
table variables do not cause recompiles
you can also use the hint OPTION (KEEP PLAN) to inhibit 6
row recompile and (KEEP FIXED PLAN) to inhibit 500+ row
recompiles
>--Original Message--
>I am having a severe performance issue with a procedure,
but it only happens
>intermittently so it's difficult to track down. The
procedure is too
>complex to include in this post because it uses nested
views with lots of
>tables etc. Basically it does this:
> 1. create temp table 1 (fast)
> 2. insert query result into table 1 (100 lines or so)
> 3. create temp table 2
> 4. query temp table 1 and insert results into table 2
> 5. query temp table 1 again (different summary) and
insert results into
>table 2
> 6. query temp table 1 again (different summary) and
insert results into
>table 2
> 7. query temp table 1 again (different summary) and
insert results into
>table 2
> 8. update temp table 2
> 9. select * from temp table 2 as output from procedure
>Normally it runs very fast (a couple of seconds). When
it's slow, it takes
>30 - 150 seconds even though it's only dealing with a
hundred lines or so.
>Most of the time is consumed by lines 4 and 8 (about half
and half). The
>real mystery is line 4. It's only dealing with 100 lines
and it sometimes
>takes a minute! It is always very fast or very slow.
>Yesterday when I investigated it I found that the C
drive, which contained
>SQL Server, my main database and the temp database, was
nearly full. So I
>moved the databases to the D and E drives with lots of
space and freed up a
>bunch of space on C. But the problem continues today.
>When testing, I can run the procedure over and over
again, but it always
>finishes in a couple of seconds. When I try to display
an estimated
>execution plan, it gives me "Invalid object name" errors
on two of my temp
>tables. How can I debug it?
>Is this type of performance problem (and inability to
debug) caused by the
>use of temp tables? If so, I could rewrite it not to use
them, but it will
>require several UNIONS of similar queries, which seemed
to me would take
>longer.
>I tried setting the transaction isolation level to "READ
UNCOMMITTED" in
>case the problem was somehow caused by blocking, but that
didn't make any
>difference.
> Rick.
>
>.
>|||Hi Rick,
Thank you for using the Newsgroup and I am reviewing your post and want to
know if the community member's suggestions are helpful or if you still have
questions about it. Here I just want to provide you some more information
of troubleshooting the problem:
1) HOW TO: Troubleshoot Slow-Running Queries on SQL Server 7.0 or Later
http://support.microsoft.com/?id=243589
2) HOW TO: Troubleshoot Application Performance Issues
http://support.microsoft.com/?id=298475
3)INF: Troubleshooting Stored Procedure Recompilation
http://support.microsoft.com/?id=243586
Hope this helps! If you still have any questios about it, please feel free
to post new message here and I am glad to help! Thanks.
Best regards
Baisong Wei
Microsoft Online Support
----
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only. Thanks.

intermittent locks

We are experiencing problems intermittently.

Users report problems of various types including timeout messages. We investigate and find a user has acquired a lock which is blocking other users.

We contact the user and they have usually completed their activity and are not always aware of any problem despite them owning a lock.

When the user logs out of the application the lock clears and the system returns to normal.

Indexes have been rebuilt, auto update statistics is on.

Does anyone have any suggestions? :cool:The first thing I'd do is start watching for locks to determine how often they occur, and ask the users if they know of any activity that causes the problems associated with locking/blocking (that may give you clues about what you need to watch).

Once you understand what you are looking for, run a trace using SQL Profiler at the same time as a Performance Monitor trace watching for locking/blocking. The PerfMon trace will show you when the problem occurs, the Profiler trace will show you what caused the problem.

When you understand the cause of the problem, you can then look at changing the application to avoid the problem.

-PatP|||We are trying to gather more information from the users to track this down.

Anecdotally users believe that they have finished their activity and are simply still logged on or are running searches.

We haven't needed to kill a session, the user simply logs off.

It's almost as though the lock has been taken but not released when the activity has finished.

Does this sound likely/possible? If so any ideas what could be causing it?|||Does this sound likely/possible? If so any ideas what could be causing it?Yes, it sounds rather likely.

I'd suspect that the problem is something that the code is doing "behind the curtains" that the user is completely unaware of, but is still causing havok. Until you can compare the two traces (or provide LOTS of additional insight into your application and server configuration), we can only guess.

-PatP

Monday, March 26, 2012

Intermittent Connection Issue - How to Monitor

We have a 3rd party application which uses a connection to a SQL
Server 2005 database. It intermittently loses connnection to the
database and displays an error. The vendor is playing hardball with
resolving the issues. What we would like to do is have a small
application that can run on the machine the client applilcation is
installed on and make connection checks and logs. This way if both
loose connection we can rule out the 3rd party software as being the
issue. However, if theirs looses connection and the monitor
application does not notice anything we can use that information as
leverage for dealing with the vendor.
Is there any such application out there that would do this?
Thanks in advance.
Try this tool:
http://www.paessler.com/ipcheck/download
It has a free version that can be use to check every 15 minutes.
Thank you
Lucas
<lavaice@.gmail.com> wrote in message
news:1180719965.172880.52790@.g4g2000hsf.googlegrou ps.com...
> We have a 3rd party application which uses a connection to a SQL
> Server 2005 database. It intermittently loses connnection to the
> database and displays an error. The vendor is playing hardball with
> resolving the issues. What we would like to do is have a small
> application that can run on the machine the client applilcation is
> installed on and make connection checks and logs. This way if both
> loose connection we can rule out the 3rd party software as being the
> issue. However, if theirs looses connection and the monitor
> application does not notice anything we can use that information as
> leverage for dealing with the vendor.
> Is there any such application out there that would do this?
> Thanks in advance.
>
|||What we are looking for is something that would actually establish a
SQL connection to the database and report back if and when it was
interrupted instead of just port monitoring or service monitoring.
Thanks
Jon
On Jun 1, 3:29 pm, "Lucas Kartawidjaja" <luk...@.hotmail.com> wrote:[vbcol=seagreen]
> Try this tool:http://www.paessler.com/ipcheck/download
> It has a free version that can be use to check every 15 minutes.
> Thank you
> Lucas
> <lava...@.gmail.com> wrote in message
> news:1180719965.172880.52790@.g4g2000hsf.googlegrou ps.com...
>
|||So - write a little script that loops until an error is encountered and does
nothing but execute some sort of trivial statement. Use QA (or SMS or isql
or whatever tool you have) to execute it. You may want to look up WAITFOR
in BOL. Or perhaps just set up the profiler to monitor the dbms.
sql

Intermittent Connection Issue - How to Monitor

We have a 3rd party application which uses a connection to a SQL
Server 2005 database. It intermittently loses connnection to the
database and displays an error. The vendor is playing hardball with
resolving the issues. What we would like to do is have a small
application that can run on the machine the client applilcation is
installed on and make connection checks and logs. This way if both
loose connection we can rule out the 3rd party software as being the
issue. However, if theirs looses connection and the monitor
application does not notice anything we can use that information as
leverage for dealing with the vendor.
Is there any such application out there that would do this?
Thanks in advance.Try this tool:
http://www.paessler.com/ipcheck/download
It has a free version that can be use to check every 15 minutes.
Thank you
Lucas
<lavaice@.gmail.com> wrote in message
news:1180719965.172880.52790@.g4g2000hsf.googlegroups.com...
> We have a 3rd party application which uses a connection to a SQL
> Server 2005 database. It intermittently loses connnection to the
> database and displays an error. The vendor is playing hardball with
> resolving the issues. What we would like to do is have a small
> application that can run on the machine the client applilcation is
> installed on and make connection checks and logs. This way if both
> loose connection we can rule out the 3rd party software as being the
> issue. However, if theirs looses connection and the monitor
> application does not notice anything we can use that information as
> leverage for dealing with the vendor.
> Is there any such application out there that would do this?
> Thanks in advance.
>

Intermittent Connection Issue - How to Monitor

We have a 3rd party application which uses a connection to a SQL
Server 2005 database. It intermittently loses connnection to the
database and displays an error. The vendor is playing hardball with
resolving the issues. What we would like to do is have a small
application that can run on the machine the client applilcation is
installed on and make connection checks and logs. This way if both
loose connection we can rule out the 3rd party software as being the
issue. However, if theirs looses connection and the monitor
application does not notice anything we can use that information as
leverage for dealing with the vendor.
Is there any such application out there that would do this?
Thanks in advance.Try this tool:
http://www.paessler.com/ipcheck/download
It has a free version that can be use to check every 15 minutes.
Thank you
Lucas
<lavaice@.gmail.com> wrote in message
news:1180719965.172880.52790@.g4g2000hsf.googlegroups.com...
> We have a 3rd party application which uses a connection to a SQL
> Server 2005 database. It intermittently loses connnection to the
> database and displays an error. The vendor is playing hardball with
> resolving the issues. What we would like to do is have a small
> application that can run on the machine the client applilcation is
> installed on and make connection checks and logs. This way if both
> loose connection we can rule out the 3rd party software as being the
> issue. However, if theirs looses connection and the monitor
> application does not notice anything we can use that information as
> leverage for dealing with the vendor.
> Is there any such application out there that would do this?
> Thanks in advance.
>|||What we are looking for is something that would actually establish a
SQL connection to the database and report back if and when it was
interrupted instead of just port monitoring or service monitoring.
Thanks
Jon
On Jun 1, 3:29 pm, "Lucas Kartawidjaja" <luk...@.hotmail.com> wrote:
> Try this tool:http://www.paessler.com/ipcheck/download
> It has a free version that can be use to check every 15 minutes.
> Thank you
> Lucas
> <lava...@.gmail.com> wrote in message
> news:1180719965.172880.52790@.g4g2000hsf.googlegroups.com...
> > We have a 3rd party application which uses a connection to a SQL
> > Server 2005 database. It intermittently loses connnection to the
> > database and displays an error. The vendor is playing hardball with
> > resolving the issues. What we would like to do is have a small
> > application that can run on the machine the client applilcation is
> > installed on and make connection checks and logs. This way if both
> > loose connection we can rule out the 3rd party software as being the
> > issue. However, if theirs looses connection and the monitor
> > application does not notice anything we can use that information as
> > leverage for dealing with the vendor.
> > Is there any such application out there that would do this?
> > Thanks in advance.|||So - write a little script that loops until an error is encountered and does
nothing but execute some sort of trivial statement. Use QA (or SMS or isql
or whatever tool you have) to execute it. You may want to look up WAITFOR
in BOL. Or perhaps just set up the profiler to monitor the dbms.