Sql server® 2012 t-sql fundamentals



Download 10,93 Mb.
Pdf ko'rish
bet339/443
Sana26.01.2022
Hajmi10,93 Mb.
#411755
1   ...   335   336   337   338   339   340   341   342   ...   443
Bog'liq
BookSQL

 

CHAPTER 9

 

Transactions and Concurrency



 

 301

As for reading data, the defaults are different for on-premises SQL Server installations and 

SQL Database. In an on-premises SQL Server installation, the default isolation level is called READ 

COMMITTED. In this isolation, when you try to read data, by default your transaction requests a 

shared lock on the data resource and releases the lock as soon as the read statement is done with 

that resource. This lock mode is called “shared” because multiple transactions can hold shared 

locks on the same data resource simultaneously. Although you cannot change the lock mode and 

duration required when you are modifying data, you can control the way locking is handled when 

you are reading data by changing your isolation level. As mentioned, I will elaborate on this later 

in this chapter.

In SQL Database, the default isolation level is called READ COMMITTED SNAPSHOT. Instead of 

relying on locking, this isolation relies on a row-versioning technology. Under this isolation level, 

readers do not require shared locks, and therefore they never wait; they rely on the row-version-

ing technology to provide the expected isolation. In practical terms, this means that under the 

READ COMMITTED isolation level, if a transaction modifies rows, until the transaction completes, 

another trans action can’t read the same rows. This approach to concurrency control is known as 

the pessimistic concurrency approach. Under the READ COMMITTED SNAPSHOT isolation level, if 

a transaction modifies rows, another transaction trying to read the data will get the last commit-

ted state of the rows that was available when the statement started. This approach to concurrency 

control is known as the optimistic concurrency approach.

This lock interaction between transactions is known as lock compatibility. Table 9-1 shows the lock 

compatibility of exclusive and shared locks (when you are working with an isolation level that generates 

these locks). The columns represent granted lock modes, and the rows represent requested lock modes. 


Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   335   336   337   338   339   340   341   342   ...   443




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish