Hi all,
I don't understand this.
I had SPID 104 blocked by SPID 87. However, SPID 87 was sleeping. How
can that be?
Please advise.
Audrey
*** Sent via Developersdex http://www.developersdex.com ***A sleeping spid is simply one that isn't currently "doing" anything. It can
certainly be sitting there with a lock on a row/table from an update
statement. A bad example is beginning a transaction, doing an update and
then presenting a message box to a user and wait for them to click 'OK'.
What happens if they wander off for lunch? The resource is locked until
they return or a timeout occurs on the connection.
--
TheSQLGuru
President
Indicium Resources, Inc.
"Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
news:uUfKwJNjHHA.3472@.TK2MSFTNGP04.phx.gbl...
> Hi all,
> I don't understand this.
> I had SPID 104 blocked by SPID 87. However, SPID 87 was sleeping. How
> can that be?
> Please advise.
> Audrey
> *** Sent via Developersdex http://www.developersdex.com ***
Showing posts with label blocks. Show all posts
Showing posts with label blocks. Show all posts
Monday, February 20, 2012
Locks and Blocks
Hi all,
I don't understand this.
I had SPID 104 blocked by SPID 87. However, SPID 87 was sleeping. How
can that be?
Please advise.
Audrey
*** Sent via Developersdex http://www.codecomments.com ***A sleeping spid is simply one that isn't currently "doing" anything. It can
certainly be sitting there with a lock on a row/table from an update
statement. A bad example is beginning a transaction, doing an update and
then presenting a message box to a user and wait for them to click 'OK'.
What happens if they wander off for lunch? The resource is locked until
they return or a timeout occurs on the connection.
TheSQLGuru
President
Indicium Resources, Inc.
"Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
news:uUfKwJNjHHA.3472@.TK2MSFTNGP04.phx.gbl...
> Hi all,
> I don't understand this.
> I had SPID 104 blocked by SPID 87. However, SPID 87 was sleeping. How
> can that be?
> Please advise.
> Audrey
> *** Sent via Developersdex http://www.codecomments.com ***|||Fair statement.
Here's a situation:
I have a stored procedure that:
BEGIN TRAN
1) INSERT INTO
2) UPDATE
3) UPDATE
4) INSERT INTO
5) UPDATE
COMMIT TRAN
So, let's say there are SPID 1 and SPID 2 to run the procedure. Would I
be correct to say that SPID 1 needs to complete the transaction before
SPID 2 runs the procedure?
If so, what if SPID1 never makes it to the COMMIT TRAN?
More so, what are some reasons for SPID1 NEVER to make it to COMMIT
TRAN?...hence, causing a block.
*** Sent via Developersdex http://www.codecomments.com ***|||"Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
news:%231MkKjOjHHA.1240@.TK2MSFTNGP04.phx.gbl...
> Fair statement.
> Here's a situation:
> I have a stored procedure that:
> BEGIN TRAN
> 1) INSERT INTO
> 2) UPDATE
> 3) UPDATE
> 4) INSERT INTO
> 5) UPDATE
> COMMIT TRAN
> So, let's say there are SPID 1 and SPID 2 to run the procedure. Would I
> be correct to say that SPID 1 needs to complete the transaction before
> SPID 2 runs the procedure?
Not necessarily.
If the tables are properly indexed and SQL Server can determine that the the
rows affected by SPID 1 won't interact with SPID 2, they should run just
fine side-by-side.
If they need to update the same rows (or SQL Server can't determine for sure
which rows are involved) then yes, SPID 1 can block SPID 2.
> If so, what if SPID1 never makes it to the COMMIT TRAN?
SPID 2 can be blocked.
> More so, what are some reasons for SPID1 NEVER to make it to COMMIT
> TRAN?...hence, causing a block.
Generally, errors or the like. Or something else blocking the available
resources.
> *** Sent via Developersdex http://www.codecomments.com ***
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html|||Also, with proper error handling, the sproc should ALWAYS either get to the
commit or do a rollback on error.
blocking (and even deadlocks) can occur given your example, especially if
the tables involved are used multiple times in the 5 steps listed.
TheSQLGuru
President
Indicium Resources, Inc.
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:u%23sOh1PjHHA.2552@.TK2MSFTNGP06.phx.gbl...
> "Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
> news:%231MkKjOjHHA.1240@.TK2MSFTNGP04.phx.gbl...
> Not necessarily.
> If the tables are properly indexed and SQL Server can determine that the
> the rows affected by SPID 1 won't interact with SPID 2, they should run
> just fine side-by-side.
> If they need to update the same rows (or SQL Server can't determine for
> sure which rows are involved) then yes, SPID 1 can block SPID 2.
>
> SPID 2 can be blocked.
>
> Generally, errors or the like. Or something else blocking the available
> resources.
>
>
> --
> Greg Moore
> SQL Server DBA Consulting Remote and Onsite available!
> Email: sql (at) greenms.com
> http://www.greenms.com/sqlserver.html
>
I don't understand this.
I had SPID 104 blocked by SPID 87. However, SPID 87 was sleeping. How
can that be?
Please advise.
Audrey
*** Sent via Developersdex http://www.codecomments.com ***A sleeping spid is simply one that isn't currently "doing" anything. It can
certainly be sitting there with a lock on a row/table from an update
statement. A bad example is beginning a transaction, doing an update and
then presenting a message box to a user and wait for them to click 'OK'.
What happens if they wander off for lunch? The resource is locked until
they return or a timeout occurs on the connection.
TheSQLGuru
President
Indicium Resources, Inc.
"Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
news:uUfKwJNjHHA.3472@.TK2MSFTNGP04.phx.gbl...
> Hi all,
> I don't understand this.
> I had SPID 104 blocked by SPID 87. However, SPID 87 was sleeping. How
> can that be?
> Please advise.
> Audrey
> *** Sent via Developersdex http://www.codecomments.com ***|||Fair statement.
Here's a situation:
I have a stored procedure that:
BEGIN TRAN
1) INSERT INTO
2) UPDATE
3) UPDATE
4) INSERT INTO
5) UPDATE
COMMIT TRAN
So, let's say there are SPID 1 and SPID 2 to run the procedure. Would I
be correct to say that SPID 1 needs to complete the transaction before
SPID 2 runs the procedure?
If so, what if SPID1 never makes it to the COMMIT TRAN?
More so, what are some reasons for SPID1 NEVER to make it to COMMIT
TRAN?...hence, causing a block.
*** Sent via Developersdex http://www.codecomments.com ***|||"Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
news:%231MkKjOjHHA.1240@.TK2MSFTNGP04.phx.gbl...
> Fair statement.
> Here's a situation:
> I have a stored procedure that:
> BEGIN TRAN
> 1) INSERT INTO
> 2) UPDATE
> 3) UPDATE
> 4) INSERT INTO
> 5) UPDATE
> COMMIT TRAN
> So, let's say there are SPID 1 and SPID 2 to run the procedure. Would I
> be correct to say that SPID 1 needs to complete the transaction before
> SPID 2 runs the procedure?
Not necessarily.
If the tables are properly indexed and SQL Server can determine that the the
rows affected by SPID 1 won't interact with SPID 2, they should run just
fine side-by-side.
If they need to update the same rows (or SQL Server can't determine for sure
which rows are involved) then yes, SPID 1 can block SPID 2.
> If so, what if SPID1 never makes it to the COMMIT TRAN?
SPID 2 can be blocked.
> More so, what are some reasons for SPID1 NEVER to make it to COMMIT
> TRAN?...hence, causing a block.
Generally, errors or the like. Or something else blocking the available
resources.
> *** Sent via Developersdex http://www.codecomments.com ***
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html|||Also, with proper error handling, the sproc should ALWAYS either get to the
commit or do a rollback on error.
blocking (and even deadlocks) can occur given your example, especially if
the tables involved are used multiple times in the 5 steps listed.
TheSQLGuru
President
Indicium Resources, Inc.
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:u%23sOh1PjHHA.2552@.TK2MSFTNGP06.phx.gbl...
> "Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
> news:%231MkKjOjHHA.1240@.TK2MSFTNGP04.phx.gbl...
> Not necessarily.
> If the tables are properly indexed and SQL Server can determine that the
> the rows affected by SPID 1 won't interact with SPID 2, they should run
> just fine side-by-side.
> If they need to update the same rows (or SQL Server can't determine for
> sure which rows are involved) then yes, SPID 1 can block SPID 2.
>
> SPID 2 can be blocked.
>
> Generally, errors or the like. Or something else blocking the available
> resources.
>
>
> --
> Greg Moore
> SQL Server DBA Consulting Remote and Onsite available!
> Email: sql (at) greenms.com
> http://www.greenms.com/sqlserver.html
>
Locks and Blocks
Hi all,
I don't understand this.
I had SPID 104 blocked by SPID 87. However, SPID 87 was sleeping. How
can that be?
Please advise.
Audrey
*** Sent via Developersdex http://www.codecomments.com ***
A sleeping spid is simply one that isn't currently "doing" anything. It can
certainly be sitting there with a lock on a row/table from an update
statement. A bad example is beginning a transaction, doing an update and
then presenting a message box to a user and wait for them to click 'OK'.
What happens if they wander off for lunch? The resource is locked until
they return or a timeout occurs on the connection.
TheSQLGuru
President
Indicium Resources, Inc.
"Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
news:uUfKwJNjHHA.3472@.TK2MSFTNGP04.phx.gbl...
> Hi all,
> I don't understand this.
> I had SPID 104 blocked by SPID 87. However, SPID 87 was sleeping. How
> can that be?
> Please advise.
> Audrey
> *** Sent via Developersdex http://www.codecomments.com ***
|||Fair statement.
Here's a situation:
I have a stored procedure that:
BEGIN TRAN
1) INSERT INTO
2) UPDATE
3) UPDATE
4) INSERT INTO
5) UPDATE
COMMIT TRAN
So, let's say there are SPID 1 and SPID 2 to run the procedure. Would I
be correct to say that SPID 1 needs to complete the transaction before
SPID 2 runs the procedure?
If so, what if SPID1 never makes it to the COMMIT TRAN?
More so, what are some reasons for SPID1 NEVER to make it to COMMIT
TRAN?...hence, causing a block.
*** Sent via Developersdex http://www.codecomments.com ***
|||"Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
news:%231MkKjOjHHA.1240@.TK2MSFTNGP04.phx.gbl...
> Fair statement.
> Here's a situation:
> I have a stored procedure that:
> BEGIN TRAN
> 1) INSERT INTO
> 2) UPDATE
> 3) UPDATE
> 4) INSERT INTO
> 5) UPDATE
> COMMIT TRAN
> So, let's say there are SPID 1 and SPID 2 to run the procedure. Would I
> be correct to say that SPID 1 needs to complete the transaction before
> SPID 2 runs the procedure?
Not necessarily.
If the tables are properly indexed and SQL Server can determine that the the
rows affected by SPID 1 won't interact with SPID 2, they should run just
fine side-by-side.
If they need to update the same rows (or SQL Server can't determine for sure
which rows are involved) then yes, SPID 1 can block SPID 2.
> If so, what if SPID1 never makes it to the COMMIT TRAN?
SPID 2 can be blocked.
> More so, what are some reasons for SPID1 NEVER to make it to COMMIT
> TRAN?...hence, causing a block.
Generally, errors or the like. Or something else blocking the available
resources.
> *** Sent via Developersdex http://www.codecomments.com ***
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html
|||Also, with proper error handling, the sproc should ALWAYS either get to the
commit or do a rollback on error.
blocking (and even deadlocks) can occur given your example, especially if
the tables involved are used multiple times in the 5 steps listed.
TheSQLGuru
President
Indicium Resources, Inc.
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:u%23sOh1PjHHA.2552@.TK2MSFTNGP06.phx.gbl...
> "Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
> news:%231MkKjOjHHA.1240@.TK2MSFTNGP04.phx.gbl...
> Not necessarily.
> If the tables are properly indexed and SQL Server can determine that the
> the rows affected by SPID 1 won't interact with SPID 2, they should run
> just fine side-by-side.
> If they need to update the same rows (or SQL Server can't determine for
> sure which rows are involved) then yes, SPID 1 can block SPID 2.
>
> SPID 2 can be blocked.
>
> Generally, errors or the like. Or something else blocking the available
> resources.
>
>
> --
> Greg Moore
> SQL Server DBA Consulting Remote and Onsite available!
> Email: sql (at) greenms.com
> http://www.greenms.com/sqlserver.html
>
I don't understand this.
I had SPID 104 blocked by SPID 87. However, SPID 87 was sleeping. How
can that be?
Please advise.
Audrey
*** Sent via Developersdex http://www.codecomments.com ***
A sleeping spid is simply one that isn't currently "doing" anything. It can
certainly be sitting there with a lock on a row/table from an update
statement. A bad example is beginning a transaction, doing an update and
then presenting a message box to a user and wait for them to click 'OK'.
What happens if they wander off for lunch? The resource is locked until
they return or a timeout occurs on the connection.
TheSQLGuru
President
Indicium Resources, Inc.
"Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
news:uUfKwJNjHHA.3472@.TK2MSFTNGP04.phx.gbl...
> Hi all,
> I don't understand this.
> I had SPID 104 blocked by SPID 87. However, SPID 87 was sleeping. How
> can that be?
> Please advise.
> Audrey
> *** Sent via Developersdex http://www.codecomments.com ***
|||Fair statement.
Here's a situation:
I have a stored procedure that:
BEGIN TRAN
1) INSERT INTO
2) UPDATE
3) UPDATE
4) INSERT INTO
5) UPDATE
COMMIT TRAN
So, let's say there are SPID 1 and SPID 2 to run the procedure. Would I
be correct to say that SPID 1 needs to complete the transaction before
SPID 2 runs the procedure?
If so, what if SPID1 never makes it to the COMMIT TRAN?
More so, what are some reasons for SPID1 NEVER to make it to COMMIT
TRAN?...hence, causing a block.
*** Sent via Developersdex http://www.codecomments.com ***
|||"Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
news:%231MkKjOjHHA.1240@.TK2MSFTNGP04.phx.gbl...
> Fair statement.
> Here's a situation:
> I have a stored procedure that:
> BEGIN TRAN
> 1) INSERT INTO
> 2) UPDATE
> 3) UPDATE
> 4) INSERT INTO
> 5) UPDATE
> COMMIT TRAN
> So, let's say there are SPID 1 and SPID 2 to run the procedure. Would I
> be correct to say that SPID 1 needs to complete the transaction before
> SPID 2 runs the procedure?
Not necessarily.
If the tables are properly indexed and SQL Server can determine that the the
rows affected by SPID 1 won't interact with SPID 2, they should run just
fine side-by-side.
If they need to update the same rows (or SQL Server can't determine for sure
which rows are involved) then yes, SPID 1 can block SPID 2.
> If so, what if SPID1 never makes it to the COMMIT TRAN?
SPID 2 can be blocked.
> More so, what are some reasons for SPID1 NEVER to make it to COMMIT
> TRAN?...hence, causing a block.
Generally, errors or the like. Or something else blocking the available
resources.
> *** Sent via Developersdex http://www.codecomments.com ***
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html
|||Also, with proper error handling, the sproc should ALWAYS either get to the
commit or do a rollback on error.
blocking (and even deadlocks) can occur given your example, especially if
the tables involved are used multiple times in the 5 steps listed.
TheSQLGuru
President
Indicium Resources, Inc.
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:u%23sOh1PjHHA.2552@.TK2MSFTNGP06.phx.gbl...
> "Audrey Ng" <odd26uk@.yahoo.co.uk> wrote in message
> news:%231MkKjOjHHA.1240@.TK2MSFTNGP04.phx.gbl...
> Not necessarily.
> If the tables are properly indexed and SQL Server can determine that the
> the rows affected by SPID 1 won't interact with SPID 2, they should run
> just fine side-by-side.
> If they need to update the same rows (or SQL Server can't determine for
> sure which rows are involved) then yes, SPID 1 can block SPID 2.
>
> SPID 2 can be blocked.
>
> Generally, errors or the like. Or something else blocking the available
> resources.
>
>
> --
> Greg Moore
> SQL Server DBA Consulting Remote and Onsite available!
> Email: sql (at) greenms.com
> http://www.greenms.com/sqlserver.html
>
Locks and Blocking
I am working on solving performance problems for a client experiencing
frequent blocks on their server which has 4 CPUs and 4GB or RAM. Their
application is a self-developed VB6 application that is very resource
intensive. With about 150 simultaneous users CPU utilization frequently
exceeds 90%. Yesterday their server froze at 100% CPU utilization, requiring
all users to exit and the server to be rebooted.
Their programming model uses ADO recordsets. Once a recordset is fetched to
the application and displayed on the form, the rsX variable is set to nothing
and the user can update the form. When the OK button is pressed on the form,
the application code does the following:
strSQL = "Select * From Contact Where 1=2"
Set rsX = Openrecordset(strSQL)
Rsx.Field1 = Form!Field1
...
...
Rsx.Fieldn = Form!Fieldn
Rsx.Update
Question: Does the grabbing of a recordset in this manner lock the whole
table since there is no individual record or page to lock? An if 20 users did
this simultaneously, would that lead to a blocking issue?
Any insight would be appreciated!
Larry Menzin
American Techsystems Corp.
These links may help. The first link is a VB link about locking -
looks like you definitely might have some locking issues.
http://msdn.microsoft.com/library/de...oidlocking.asp
http://www.sql-server-performance.co...cing_locks.asp
http://msdn.microsoft.com/library/de...on_7a_1hf7.asp
|||Do each of the tables have a valid PK Constraint defined on them? Is the
Update issued by ADO using the PK to do the update? If not it is more
likely the Update is causing the problems. That is a pretty lame way to
update rows anyway. They should create a stored procedure to do the update
and call that from the front end instead.
Andrew J. Kelly SQL MVP
"Larry Menzin" <LarryMenzin@.discussions.microsoft.com> wrote in message
news:0DAF194C-3019-4E7C-AB0F-691B95911D0E@.microsoft.com...
>I am working on solving performance problems for a client experiencing
> frequent blocks on their server which has 4 CPUs and 4GB or RAM. Their
> application is a self-developed VB6 application that is very resource
> intensive. With about 150 simultaneous users CPU utilization frequently
> exceeds 90%. Yesterday their server froze at 100% CPU utilization,
> requiring
> all users to exit and the server to be rebooted.
> Their programming model uses ADO recordsets. Once a recordset is fetched
> to
> the application and displayed on the form, the rsX variable is set to
> nothing
> and the user can update the form. When the OK button is pressed on the
> form,
> the application code does the following:
> strSQL = "Select * From Contact Where 1=2"
> Set rsX = Openrecordset(strSQL)
> Rsx.Field1 = Form!Field1
> ...
> ...
> Rsx.Fieldn = Form!Fieldn
> Rsx.Update
> Question: Does the grabbing of a recordset in this manner lock the whole
> table since there is no individual record or page to lock? An if 20 users
> did
> this simultaneously, would that lead to a blocking issue?
> Any insight would be appreciated!
> --
> Larry Menzin
> American Techsystems Corp.
|||Hi,
When u execute a select statement it will fetech all the columns and
rows now imagine if the table has 40 or 45 coulmns then how much
resource it will use .
u should field name and ur where clause.
Secondly when the recodset work is done close the recordset.
hope this help
from
killer
Andrew J. Kelly wrote:[vbcol=seagreen]
> Do each of the tables have a valid PK Constraint defined on them? Is the
> Update issued by ADO using the PK to do the update? If not it is more
> likely the Update is causing the problems. That is a pretty lame way to
> update rows anyway. They should create a stored procedure to do the update
> and call that from the front end instead.
> --
> Andrew J. Kelly SQL MVP
>
> "Larry Menzin" <LarryMenzin@.discussions.microsoft.com> wrote in message
> news:0DAF194C-3019-4E7C-AB0F-691B95911D0E@.microsoft.com...
|||Hi
Run profiler and see what/where this is happening. You may want to look for
items in the locking event class and use the read/write/duration values to
find queries that take a long time and do a large number of I/O. You will
then be able to analyse query plans and indexes, or maybe even want to pass
the output of a trace into the index tuning wizard and see what it comes up
with.
John
"Larry Menzin" wrote:
> I am working on solving performance problems for a client experiencing
> frequent blocks on their server which has 4 CPUs and 4GB or RAM. Their
> application is a self-developed VB6 application that is very resource
> intensive. With about 150 simultaneous users CPU utilization frequently
> exceeds 90%. Yesterday their server froze at 100% CPU utilization, requiring
> all users to exit and the server to be rebooted.
> Their programming model uses ADO recordsets. Once a recordset is fetched to
> the application and displayed on the form, the rsX variable is set to nothing
> and the user can update the form. When the OK button is pressed on the form,
> the application code does the following:
> strSQL = "Select * From Contact Where 1=2"
> Set rsX = Openrecordset(strSQL)
> Rsx.Field1 = Form!Field1
> ...
> ...
> Rsx.Fieldn = Form!Fieldn
> Rsx.Update
> Question: Does the grabbing of a recordset in this manner lock the whole
> table since there is no individual record or page to lock? An if 20 users did
> this simultaneously, would that lead to a blocking issue?
> Any insight would be appreciated!
> --
> Larry Menzin
> American Techsystems Corp.
frequent blocks on their server which has 4 CPUs and 4GB or RAM. Their
application is a self-developed VB6 application that is very resource
intensive. With about 150 simultaneous users CPU utilization frequently
exceeds 90%. Yesterday their server froze at 100% CPU utilization, requiring
all users to exit and the server to be rebooted.
Their programming model uses ADO recordsets. Once a recordset is fetched to
the application and displayed on the form, the rsX variable is set to nothing
and the user can update the form. When the OK button is pressed on the form,
the application code does the following:
strSQL = "Select * From Contact Where 1=2"
Set rsX = Openrecordset(strSQL)
Rsx.Field1 = Form!Field1
...
...
Rsx.Fieldn = Form!Fieldn
Rsx.Update
Question: Does the grabbing of a recordset in this manner lock the whole
table since there is no individual record or page to lock? An if 20 users did
this simultaneously, would that lead to a blocking issue?
Any insight would be appreciated!
Larry Menzin
American Techsystems Corp.
These links may help. The first link is a VB link about locking -
looks like you definitely might have some locking issues.
http://msdn.microsoft.com/library/de...oidlocking.asp
http://www.sql-server-performance.co...cing_locks.asp
http://msdn.microsoft.com/library/de...on_7a_1hf7.asp
|||Do each of the tables have a valid PK Constraint defined on them? Is the
Update issued by ADO using the PK to do the update? If not it is more
likely the Update is causing the problems. That is a pretty lame way to
update rows anyway. They should create a stored procedure to do the update
and call that from the front end instead.
Andrew J. Kelly SQL MVP
"Larry Menzin" <LarryMenzin@.discussions.microsoft.com> wrote in message
news:0DAF194C-3019-4E7C-AB0F-691B95911D0E@.microsoft.com...
>I am working on solving performance problems for a client experiencing
> frequent blocks on their server which has 4 CPUs and 4GB or RAM. Their
> application is a self-developed VB6 application that is very resource
> intensive. With about 150 simultaneous users CPU utilization frequently
> exceeds 90%. Yesterday their server froze at 100% CPU utilization,
> requiring
> all users to exit and the server to be rebooted.
> Their programming model uses ADO recordsets. Once a recordset is fetched
> to
> the application and displayed on the form, the rsX variable is set to
> nothing
> and the user can update the form. When the OK button is pressed on the
> form,
> the application code does the following:
> strSQL = "Select * From Contact Where 1=2"
> Set rsX = Openrecordset(strSQL)
> Rsx.Field1 = Form!Field1
> ...
> ...
> Rsx.Fieldn = Form!Fieldn
> Rsx.Update
> Question: Does the grabbing of a recordset in this manner lock the whole
> table since there is no individual record or page to lock? An if 20 users
> did
> this simultaneously, would that lead to a blocking issue?
> Any insight would be appreciated!
> --
> Larry Menzin
> American Techsystems Corp.
|||Hi,
When u execute a select statement it will fetech all the columns and
rows now imagine if the table has 40 or 45 coulmns then how much
resource it will use .
u should field name and ur where clause.
Secondly when the recodset work is done close the recordset.
hope this help
from
killer
Andrew J. Kelly wrote:[vbcol=seagreen]
> Do each of the tables have a valid PK Constraint defined on them? Is the
> Update issued by ADO using the PK to do the update? If not it is more
> likely the Update is causing the problems. That is a pretty lame way to
> update rows anyway. They should create a stored procedure to do the update
> and call that from the front end instead.
> --
> Andrew J. Kelly SQL MVP
>
> "Larry Menzin" <LarryMenzin@.discussions.microsoft.com> wrote in message
> news:0DAF194C-3019-4E7C-AB0F-691B95911D0E@.microsoft.com...
|||Hi
Run profiler and see what/where this is happening. You may want to look for
items in the locking event class and use the read/write/duration values to
find queries that take a long time and do a large number of I/O. You will
then be able to analyse query plans and indexes, or maybe even want to pass
the output of a trace into the index tuning wizard and see what it comes up
with.
John
"Larry Menzin" wrote:
> I am working on solving performance problems for a client experiencing
> frequent blocks on their server which has 4 CPUs and 4GB or RAM. Their
> application is a self-developed VB6 application that is very resource
> intensive. With about 150 simultaneous users CPU utilization frequently
> exceeds 90%. Yesterday their server froze at 100% CPU utilization, requiring
> all users to exit and the server to be rebooted.
> Their programming model uses ADO recordsets. Once a recordset is fetched to
> the application and displayed on the form, the rsX variable is set to nothing
> and the user can update the form. When the OK button is pressed on the form,
> the application code does the following:
> strSQL = "Select * From Contact Where 1=2"
> Set rsX = Openrecordset(strSQL)
> Rsx.Field1 = Form!Field1
> ...
> ...
> Rsx.Fieldn = Form!Fieldn
> Rsx.Update
> Question: Does the grabbing of a recordset in this manner lock the whole
> table since there is no individual record or page to lock? An if 20 users did
> this simultaneously, would that lead to a blocking issue?
> Any insight would be appreciated!
> --
> Larry Menzin
> American Techsystems Corp.
Locks and Blocking
I am working on solving performance problems for a client experiencing
frequent blocks on their server which has 4 CPUs and 4GB or RAM. Their
application is a self-developed VB6 application that is very resource
intensive. With about 150 simultaneous users CPU utilization frequently
exceeds 90%. Yesterday their server froze at 100% CPU utilization, requiring
all users to exit and the server to be rebooted.
Their programming model uses ADO recordsets. Once a recordset is fetched to
the application and displayed on the form, the rsX variable is set to nothin
g
and the user can update the form. When the OK button is pressed on the form,
the application code does the following:
strSQL = "Select * From Contact Where 1=2"
Set rsX = Openrecordset(strSQL)
Rsx.Field1 = Form!Field1
...
...
Rsx.Fieldn = Form!Fieldn
Rsx.Update
Question: Does the grabbing of a recordset in this manner lock the whole
table since there is no individual record or page to lock? An if 20 users di
d
this simultaneously, would that lead to a blocking issue?
Any insight would be appreciated!
Larry Menzin
American Techsystems Corp.These links may help. The first link is a VB link about locking -
looks like you definitely might have some locking issues.
http://msdn.microsoft.com/library/d...
idlocking.asp
http://www.sql-server-performance.c...ucing_locks.asp
http://msdn.microsoft.com/library/d... />
a_1hf7.asp|||Do each of the tables have a valid PK Constraint defined on them? Is the
Update issued by ADO using the PK to do the update? If not it is more
likely the Update is causing the problems. That is a pretty lame way to
update rows anyway. They should create a stored procedure to do the update
and call that from the front end instead.
Andrew J. Kelly SQL MVP
"Larry Menzin" <LarryMenzin@.discussions.microsoft.com> wrote in message
news:0DAF194C-3019-4E7C-AB0F-691B95911D0E@.microsoft.com...
>I am working on solving performance problems for a client experiencing
> frequent blocks on their server which has 4 CPUs and 4GB or RAM. Their
> application is a self-developed VB6 application that is very resource
> intensive. With about 150 simultaneous users CPU utilization frequently
> exceeds 90%. Yesterday their server froze at 100% CPU utilization,
> requiring
> all users to exit and the server to be rebooted.
> Their programming model uses ADO recordsets. Once a recordset is fetched
> to
> the application and displayed on the form, the rsX variable is set to
> nothing
> and the user can update the form. When the OK button is pressed on the
> form,
> the application code does the following:
> strSQL = "Select * From Contact Where 1=2"
> Set rsX = Openrecordset(strSQL)
> Rsx.Field1 = Form!Field1
> ...
> ...
> Rsx.Fieldn = Form!Fieldn
> Rsx.Update
> Question: Does the grabbing of a recordset in this manner lock the whole
> table since there is no individual record or page to lock? An if 20 users
> did
> this simultaneously, would that lead to a blocking issue?
> Any insight would be appreciated!
> --
> Larry Menzin
> American Techsystems Corp.|||Hi,
When u execute a select statement it will fetech all the columns and
rows now imagine if the table has 40 or 45 coulmns then how much
resource it will use .
u should field name and ur where clause.
Secondly when the recodset work is done close the recordset.
hope this help
from
killer
Andrew J. Kelly wrote:[vbcol=seagreen]
> Do each of the tables have a valid PK Constraint defined on them? Is the
> Update issued by ADO using the PK to do the update? If not it is more
> likely the Update is causing the problems. That is a pretty lame way to
> update rows anyway. They should create a stored procedure to do the updat
e
> and call that from the front end instead.
> --
> Andrew J. Kelly SQL MVP
>
> "Larry Menzin" <LarryMenzin@.discussions.microsoft.com> wrote in message
> news:0DAF194C-3019-4E7C-AB0F-691B95911D0E@.microsoft.com...|||Hi
Run profiler and see what/where this is happening. You may want to look for
items in the locking event class and use the read/write/duration values to
find queries that take a long time and do a large number of I/O. You will
then be able to analyse query plans and indexes, or maybe even want to pass
the output of a trace into the index tuning wizard and see what it comes up
with.
John
"Larry Menzin" wrote:
> I am working on solving performance problems for a client experiencing
> frequent blocks on their server which has 4 CPUs and 4GB or RAM. Their
> application is a self-developed VB6 application that is very resource
> intensive. With about 150 simultaneous users CPU utilization frequently
> exceeds 90%. Yesterday their server froze at 100% CPU utilization, requiri
ng
> all users to exit and the server to be rebooted.
> Their programming model uses ADO recordsets. Once a recordset is fetched t
o
> the application and displayed on the form, the rsX variable is set to noth
ing
> and the user can update the form. When the OK button is pressed on the for
m,
> the application code does the following:
> strSQL = "Select * From Contact Where 1=2"
> Set rsX = Openrecordset(strSQL)
> Rsx.Field1 = Form!Field1
> ...
> ...
> Rsx.Fieldn = Form!Fieldn
> Rsx.Update
> Question: Does the grabbing of a recordset in this manner lock the whole
> table since there is no individual record or page to lock? An if 20 users
did
> this simultaneously, would that lead to a blocking issue?
> Any insight would be appreciated!
> --
> Larry Menzin
> American Techsystems Corp.
frequent blocks on their server which has 4 CPUs and 4GB or RAM. Their
application is a self-developed VB6 application that is very resource
intensive. With about 150 simultaneous users CPU utilization frequently
exceeds 90%. Yesterday their server froze at 100% CPU utilization, requiring
all users to exit and the server to be rebooted.
Their programming model uses ADO recordsets. Once a recordset is fetched to
the application and displayed on the form, the rsX variable is set to nothin
g
and the user can update the form. When the OK button is pressed on the form,
the application code does the following:
strSQL = "Select * From Contact Where 1=2"
Set rsX = Openrecordset(strSQL)
Rsx.Field1 = Form!Field1
...
...
Rsx.Fieldn = Form!Fieldn
Rsx.Update
Question: Does the grabbing of a recordset in this manner lock the whole
table since there is no individual record or page to lock? An if 20 users di
d
this simultaneously, would that lead to a blocking issue?
Any insight would be appreciated!
Larry Menzin
American Techsystems Corp.These links may help. The first link is a VB link about locking -
looks like you definitely might have some locking issues.
http://msdn.microsoft.com/library/d...
idlocking.asp
http://www.sql-server-performance.c...ucing_locks.asp
http://msdn.microsoft.com/library/d... />
a_1hf7.asp|||Do each of the tables have a valid PK Constraint defined on them? Is the
Update issued by ADO using the PK to do the update? If not it is more
likely the Update is causing the problems. That is a pretty lame way to
update rows anyway. They should create a stored procedure to do the update
and call that from the front end instead.
Andrew J. Kelly SQL MVP
"Larry Menzin" <LarryMenzin@.discussions.microsoft.com> wrote in message
news:0DAF194C-3019-4E7C-AB0F-691B95911D0E@.microsoft.com...
>I am working on solving performance problems for a client experiencing
> frequent blocks on their server which has 4 CPUs and 4GB or RAM. Their
> application is a self-developed VB6 application that is very resource
> intensive. With about 150 simultaneous users CPU utilization frequently
> exceeds 90%. Yesterday their server froze at 100% CPU utilization,
> requiring
> all users to exit and the server to be rebooted.
> Their programming model uses ADO recordsets. Once a recordset is fetched
> to
> the application and displayed on the form, the rsX variable is set to
> nothing
> and the user can update the form. When the OK button is pressed on the
> form,
> the application code does the following:
> strSQL = "Select * From Contact Where 1=2"
> Set rsX = Openrecordset(strSQL)
> Rsx.Field1 = Form!Field1
> ...
> ...
> Rsx.Fieldn = Form!Fieldn
> Rsx.Update
> Question: Does the grabbing of a recordset in this manner lock the whole
> table since there is no individual record or page to lock? An if 20 users
> did
> this simultaneously, would that lead to a blocking issue?
> Any insight would be appreciated!
> --
> Larry Menzin
> American Techsystems Corp.|||Hi,
When u execute a select statement it will fetech all the columns and
rows now imagine if the table has 40 or 45 coulmns then how much
resource it will use .
u should field name and ur where clause.
Secondly when the recodset work is done close the recordset.
hope this help
from
killer
Andrew J. Kelly wrote:[vbcol=seagreen]
> Do each of the tables have a valid PK Constraint defined on them? Is the
> Update issued by ADO using the PK to do the update? If not it is more
> likely the Update is causing the problems. That is a pretty lame way to
> update rows anyway. They should create a stored procedure to do the updat
e
> and call that from the front end instead.
> --
> Andrew J. Kelly SQL MVP
>
> "Larry Menzin" <LarryMenzin@.discussions.microsoft.com> wrote in message
> news:0DAF194C-3019-4E7C-AB0F-691B95911D0E@.microsoft.com...|||Hi
Run profiler and see what/where this is happening. You may want to look for
items in the locking event class and use the read/write/duration values to
find queries that take a long time and do a large number of I/O. You will
then be able to analyse query plans and indexes, or maybe even want to pass
the output of a trace into the index tuning wizard and see what it comes up
with.
John
"Larry Menzin" wrote:
> I am working on solving performance problems for a client experiencing
> frequent blocks on their server which has 4 CPUs and 4GB or RAM. Their
> application is a self-developed VB6 application that is very resource
> intensive. With about 150 simultaneous users CPU utilization frequently
> exceeds 90%. Yesterday their server froze at 100% CPU utilization, requiri
ng
> all users to exit and the server to be rebooted.
> Their programming model uses ADO recordsets. Once a recordset is fetched t
o
> the application and displayed on the form, the rsX variable is set to noth
ing
> and the user can update the form. When the OK button is pressed on the for
m,
> the application code does the following:
> strSQL = "Select * From Contact Where 1=2"
> Set rsX = Openrecordset(strSQL)
> Rsx.Field1 = Form!Field1
> ...
> ...
> Rsx.Fieldn = Form!Fieldn
> Rsx.Update
> Question: Does the grabbing of a recordset in this manner lock the whole
> table since there is no individual record or page to lock? An if 20 users
did
> this simultaneously, would that lead to a blocking issue?
> Any insight would be appreciated!
> --
> Larry Menzin
> American Techsystems Corp.
Subscribe to:
Posts (Atom)