Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 28th, 2004, 08:36 AM
gawdknows gawdknows is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 4 gawdknows User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
MSSQL (b)locking problem

I just want to clarify the following I obtained from a source. Is this true regarding MSS ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
"When using MSSQL a (b)locking problem can arise. When 1 user locks a row in a table in order to update it, all other users are blocked for this row. If lock escalation isn't turned off, locking can even lead to blocks on page and table level.
Oracle does this differently. When a user updates a row (with lock) than all other users still can read the old row (the consistent database). Only when Oracle is told to commit the data, during this brief period others are blocked (even deadlocks can arise).

On many of the frequently altered tables users are blocked out (even though 'optimistic locking' is used). Indexes can partly solve the problem ."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~

Reply With Quote
  #2  
Old April 28th, 2004, 08:40 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
You have the ability to specify the lock type you want to use.

Quote:
adLockBatchOptimistic - Indicates optimistic batch updates. Required for batch update mode.

adLockOptimistic - Indicates optimistic locking, record by record. The provider uses optimistic locking, locking records only when you call the Update method.

adLockPessimistic - Indicates pessimistic locking, record by record. The provider does what is necessary to ensure successful editing of the records, usually by locking records at the data source immediately after editing.

adLockReadOnly - Indicates read-only records. You cannot alter the data.

adLockUnspecified - Does not specify a type of lock. For clones, the clone is created with the same lock type as the original.

Reply With Quote
  #3  
Old April 30th, 2004, 09:47 AM
gawdknows gawdknows is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 4 gawdknows User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
so that would mean:- when the source said "When 1 user locks a row in a table in order to update it, all other users are blocked for this row" is True.

because [ and as I understand] setting adLockOptimistic, will have such an effect as above and the record will 'only be locked' when update is being carried about. Which would mean that as long as the user is updating this record, others stay out...fine with me....but then why is Oracle smarter and letting others still read the record ?

Is the answer : don't compare apples with pears

Reply With Quote
  #4  
Old April 30th, 2004, 09:53 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
They are reading the current value of the record when it is pulled. Not the edited/updated values.
When a record is being edited it is locked, so no one else can edit it. If someone requests to read the record before the edit lock is released, they will get the old data, until the lock is released.

Reply With Quote
  #5  
Old April 30th, 2004, 04:09 PM
gawdknows gawdknows is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 4 gawdknows User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hmmmmm........

You sound logical, and I am beginning to doubt about the stuff that Oracle does.

The only way out would be to see if this really happens on oracle, as stated in the source I quoted from .

nevertheless thanks and we can render this one as a close.

Reply With Quote
  #6  
Old May 5th, 2004, 12:23 PM
lostboy lostboy is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: toronto, canada
Posts: 1 lostboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to lostboy Send a message via MSN to lostboy
Oracle does have this feature, its called a read-consistent database where changes are made by one user are only visible to that user until committed and written to the actual db file. All other users see a stored version of that data that is held in the RollBack Segments (memory allocated to roll back the sql if not committed or db fails)

Reply With Quote
  #7  
Old May 8th, 2004, 02:32 PM
Chizl Chizl is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 14 Chizl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation

What Oracle is doing what MS calls Dirty Reads in SQL. The record is locked and your grabbing data that could be different in the next millisec. Locking is cumbersome in SQL and I really don't like they way the do it. SQL also will create record locks when you are doing a SELECT statement, which just baffles the hell out of me. If your getting a massive amount of hits on your SQL Server that look at the same table/records then you end up with DEAD LOCKS. Microsoft says use (NOLOCK) or the new term (READ UNCOMMITTED), in your SELECT statements to get around this issue, but that only causes an (NOLOCK) Error. This happens if someone is trying to INSERT into the table at the same time someone is doing a SELECT.. Catch 42..

I develop in 14 languages and I work for a company that does all of 7-Eleven's check cashing and help desk. We also have all of Circle-K's check cashing. If your from the US, you know these companies well and know they have a massive amount of data coming in. We are battling it out with Microsoft right now on these kind of SQL issues that just seems like bad design to me.

I have never used Oracle, but have done a lot of research on it.. It costs about 200k, vs the 20k on SQL. They may be a reason for that..

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > MSSQL (b)locking problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway