Forum

Update with(nolock)
 
Bildirimler
Hepsini Temizle

Update with(nolock)

6 Yazılar
3 Üyeler
0 Likes
8,382 Görüntüleme
(@muratsoydan)
Gönderiler: 177
Reputable Member
Konu başlatıcı
 

update deneme.dbo.personel set personelno=NULL FROM deneme.dbo.personel WITH (NOLOCK)


 


yukarıdaki sorgu ile kolondaki kayıtları update ediyorum fakat arkadaşlar nolock komutuna rağmen


kullanıcılar o tablodan select çektiklerinde sorgunun gelmediğini söylüyorlar.


UPDATE KOMUTLARDA NOLOCK KOMUTU NE KADAR ETKİLİ OLUYOR ACABA?


UPDATE KOMUTUNUN GERİ DÖNÜŞÜ 2 DAKİKAYI BULUYOR.


selamlar


teşekkürler

 
Gönderildi : 26/09/2011 15:50

(@cozumpark)
Gönderiler: 16309
Illustrious Member Yönetici
 

http://msdn.microsoft.com/en-us/library/ms187373.aspx

Table hints konusuyla ilgili bu dökümandan yararlanabilirsiniz. Özellikle READUNCOMMITTED başlığı faydalı olabilir.

Bir de sorguyu UPDATE tabloadi with(nolock) ...... şeklinde denediğinizde sonuç ne oldu?

 
Gönderildi : 26/09/2011 16:31

(@muratsoydan)
Gönderiler: 177
Reputable Member
Konu başlatıcı
 

UPDATE TABLOADI WITH(NOLOCK) DA


THE NOLOCK AND READUNCOMMITTED LOCK HINTS ARE NOT ALLOWED FOR TARGET TABLES OF INSERT,UPDATE,DELETE OR MERGE


DIYE BIR HATAVERDI

 
Gönderildi : 26/09/2011 16:46

(@mehmetguzel)
Gönderiler: 116
Estimable Member
 

Nolock ile UPDATE işlemi yapılamaz. UPDATE işlemi başlı başına bir LOCK tir. Direk tablo adını verdiğinizde NOLOCK syntax hatası verir fakat tablo adını alias olarak NOLOCK kullanırsanız parser hatayı yakamıyor. UPDATE ı NOLOCK ile yapmak yerine SELECT ettiğiniz veriler LOCK ı bekleyen veriler değilse NOLOCK ile alabilirsiniz. NOLOCK ile alınan verilerin kirli yada Uncommited veri olduğunu unutmayız.

 
Gönderildi : 26/09/2011 18:22

(@cozumpark)
Gönderiler: 16309
Illustrious Member Yönetici
 


UPDATE TABLOADI WITH(NOLOCK) DA


THE NOLOCK AND READUNCOMMITTED LOCK HINTS ARE NOT ALLOWED FOR TARGET TABLES OF INSERT,UPDATE,DELETE OR MERGE


DIYE BIR HATAVERDI



Tam da beklediğim sonuç olmuş [:)] SQL Server size Lock Hint'lerle alakalı tam bir tanımlama yapmış: NoLock ve ReadUncommitted komutları insert, update, delete ve merge işlemine tabi olan tablolarda kullanılamaz. Verdiğim döküman linkinde de bunu yazdığını okumuşsunuzdur:


READUNCOMMITTED


Specifies that dirty reads are allowed. No shared locks are issued to prevent other transactions from modifying data read by the current transaction, and exclusive locks set by other transactions do not block the current transaction from reading the locked data. Allowing dirty reads can cause higher concurrency, but at the cost of reading data modifications that then are rolled back by other transactions. This may generate errors for your transaction, present users with data that was never committed, or cause users to see records twice (or not at all). For more information about dirty reads, nonrepeatable reads, and phantom reads, see Concurrency Effects.


READUNCOMMITTED and NOLOCK hints apply only to data locks. All queries, including those with READUNCOMMITTED and NOLOCK hints, acquire Sch-S (schema stability) locks during compilation and execution. Because of this, queries are blocked when a concurrent transaction holds a Sch-M (schema modification) lock on the table. For example, a data definition language (DDL) operation acquires a Sch-M lock before it modifies the schema information of the table. Any concurrent queries, including those running with READUNCOMMITTED or NOLOCK hints, are blocked when attempting to acquire a Sch-S lock. Conversely, a query holding a Sch-S lock blocks a concurrent transaction that attempts to acquire a Sch-M lock. For more information about lock behavior, see Lock Compatibility (Database Engine).


READUNCOMMITTED and NOLOCK cannot be specified for tables modified by insert, update, or delete operations. The SQL Server query optimizer ignores the READUNCOMMITTED and NOLOCK hints in the FROM clause that apply to the target table of an UPDATE or DELETE statement.



 

 
Gönderildi : 27/09/2011 03:01

(@muratsoydan)
Gönderiler: 177
Reputable Member
Konu başlatıcı
 

herkese değerli görüşleri için çok teşekkürederim


sağolun

 
Gönderildi : 28/09/2011 02:09

Paylaş: