SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Mark Broadbent
Principal Consultant
SQLCloud
SQLCLOUD.CO.UK
lock, lockb& two smoking barrels
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
About
Mark Broadbent.
“30 billion times more intelligent than a live mattress”
Microsoft Certified Master/ Certified Solutions Master: SQL Server
Owner/ Principal at SQLCloud
Email: mark.broadbent@sqlcambs.org.uk
Twitter: retracement
Blog: http://tenbulls.co.uk
Event Lead to the UK’s first ever SQLSaturday (Cambridge) and
Cambridgeshire SQL Usergroup
Event #3 on 10/ 11/ 12th Sept 2015 (pre-cons & Community day)
http://sqlcambs.org.uk
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Agenda
Versioning
Theory
1
Isolation
2
5
X X
Locking
X
No Locking
The best part of the
presentation… Gin O‘Clock
4
3
6
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
A
C
I
D
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Concurrency-versus-Correctness
“ I s o l a t i o n i s a b a l a n c e b e t w e e n
c o n c u r r e n c y a n d c o r r e c t n e s s ” – Me *1
1st law of Concurrency Control:
Concurrent execution should not cause
application programs to malfunction.
2nd law of Concurrency Control:
Concurrent execution should not have
lower throughput or much higher
response times than serial execution.
– Jim Gray and Andreas Reuter
*1 derived from the writings of Gray, Reuter, Bernstein et.al
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Serial Processing
Read R1
Read R2
Write R3
T1
Read R1
Read R2
Write R3
T2
Read R4
Write R4
T3
Read R4
Write R4
T4
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Transaction Interleaving
T1 Read R1
T1 Read R2
T1 Write R3
T2 Read R1
T2 Read R2
T2 Write R3
T3 Read R4
T3 Write R4
T4 Read R4
T4 Write R3
T1 Read R1
T1 Read R2
T2 Read R1
T2 Read R2
T1 Write R3
T2 Write R3
T3 Read R4
T3 Write R4
T4 Read R4
T4 Write R3
T2 Read R1
T2 Read R2
T2 Write R3
T1 Read R1
T1 Read R2
T1 Write R3
T4 Read R4
T4 Write R3
T3 Read R4
T3 Write R4
T1 Read R1
T1 Read R2
T2 Read R1
T2 Read R2
T2 Write R3
T1 Write R3
T3 Read R4
T3 Write R4
T4 Read R4
T4 Write R4
T1 Read R1
T1 Read R2
T2 Read R1
T2 Read R2
T1 Write R3
T2 Write R3
T3 Read R4
T4 Read R4
T3 Write R4
T4 Write R4
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Transactional Histories
T1 Read R1
T1 Read R2
T2 Read R1
T2 Read R2
T1 Write R3
T2 Write R3
T3 Read R4
T4 Read R4
T3 Write R4
T4 Write R4
T1 SLOCK R1
T1 Read R1
T1 UNLOCK R1
T1 SLOCK R2
T2 SLOCK R1
T2 Read R1
T1 Read R2
T2 UNLOCK R1
T2 SLOCK R2
T2 Read R2
T1 UNLOCK R2
T2 UNLOCK R2
T1 XLOCK R3
T1 Write R3
T1 UNLOCK R3
T2 XLOCK R3
T2 Write R3
T2 UNLOCK R3
A transaction is
considered Two-
Phased if all LOCK
actions precede an
UNLOCK action
A transaction is
considered to be
Well-Formed if all
READ, WRITE and
UNLOCK operations
are covered by a
preceding LOCK.
Isolation
mechanism has
“serialized these
transactional
writes to same
resource
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
SERIALIZABLE
4
None
WRITE  WRITE
WRITE  READ
READ  WRITE
LOWEST: read and
write locks held to EOT
Isolation Levels
READ UNCOMMITTED
1
“Bad Dependencies”Isolation Level
Dirty Read,
Non-Repeatable Read, Phantoms,
Lost Updates
X Dependencies
WRITE  WRITE
Concurrency
GOOD: only wait on
write-write locks
READ COMMITTED
2 Non-Repeatable Read,
Phantoms , Lost Updates
WRITE  WRITE
READ  WRITE
WRITE  READ
OK: wait on both but
only writes held to EOT
REPEATABLE READ
3
Phantoms
WRITE  WRITE
READ  WRITE
WRITE  READ
LOW: read and write
locks held to EOT
READ
COMMITTED (with Snapshot
Isolation)
2 Non-Repeatable Read,
Phantoms , Lost Updates
WRITE  WRITE
GOOD: only wait on
writes held to EOT
SNAPSHOT
5 None (though Causal consistency
concerns, lost update prevention
and other behaviours)
WRITE  WRITE
GOOD: only wait on
writes held to EOT
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Isolation Levels…
• Attempt to solve reduce interleaving dependency problems
• 4 Levels are defined standard by ANSI, SQL 2005+ introduces 5th
• Pessimistic concurrency readers block writers, writers block
readers
• Optimistic concurrency isolates the writes from the reads but
not writes from writes
• Not all Isolation Levels can be used everywhere – FILESTREAM
enabled databases support only RC, RCS and SSI
• Set at session level, transaction level and statement
• Sometimes used behind the covers (such as Readable
Secondaries)
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Read Committed Lost Updates
DECLARE @basketcount INT = 1
DECLARE @newquantity INT
BEGIN TRANSACTION
SELECT @newquantity = quantity FROM GunInventory WITH
(NOLOCK) WHERE id = 1
SET @newquantity = @newquantity - @basketcount
UPDATE GunInventory SET quantity = @newquantity WHERE
id = 1
COMMIT
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Demo
Pessimistic isolation
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Locks
• Are compatible OR incompatible with each other
• Are ONLY memory structures (lock blocks) and long chains can
consume a lot of memory
• Compared by lock manager across same resource or lock partition
• Isolation determines their existence, granularity and duration
• They can be converted or escalated
• Poor queries cause less granular locks or escalation of locks
• For performance and memory savings
• Increases chances of blocking and deadlocks which cause perceived
OR actual poor performance!
• Is why developers love NOLOCK
DBA-309
Mark Broadbent · https://twitter.com/retracement · mark.broadbent@sqlcloud.co.uk · http://tenbulls.co.uk
X
IS
IU
SIU
SIX
UIX
BU
RS-S
RS-U
RI-N
RI-S
RI-U
RI-X
RX-U
RX-X
IX
RX-S
U
S
SCH-M
SCH-S
NL
NL SCH-S SCH-M S U X IS IU SIU SIX UIX BU RS-S RS-U RI-N RI-S RI-U RI-X RX-S RX-U RX-XIX
Compatible
Incompatible
Illegal
NL
SCH-S
SCH-M
S
U
X
IS
IU
No Lock
Schema Stability Lock
Schema Modification Lock
Shared
Update
Exclusive
Intent Shared
Intent Update
IX
SIU
SIX
UIX
BU
RS-S
RS-U
RI-N
Intent Exclusive
Share with Intent Update
Share with Intent Exclusive
Update with Intent Exclusive
Bulk Update
Shared Range-Shared
Shared Range-Update
Insert Range-Null
RI-S
RI-U
RI-X
RX-S
RX-U
RX-X
Insert Range-Shared
Insert Range-Update
Insert Range-Exclusive
Exclusive Range-Shared
Exclusive Range-Update
Exclusive Range-Exclusive
SQL Server
Lock Compatibility Chart
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Granularity and Escalation
Free Space
Data Page
IX
Partition
orders
Table
X
X
Row
IX
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Granularity and Escalation
Free Space
Data Page
Partition
orders
Table
Row
ALTER <table> SET
(LOCK_ESCALATION
= auto| table| disable)
Don’t escalate by TF1211
or take artificial IS on table
Ignore # locks by TF1224 X
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
orders
id status
1 0
2 2
3 1
4 0
(U)pdate lock …a special kind of lock
UPDATE orders
SET status = 1
WHERE id > 1
AND id < 4
spid 115
UPDATE orders
SET status = 1
WHERE id > 1
AND id < 3
spid 162
Lock will be blocked!
SEARCH
PHASE
X
U
S
S U X
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
orders
id status
1 0
2 2
3 1
4 0
(U)pdate lock …a special kind of lock
UPDATE orders
SET status = 1
WHERE id > 1
AND id < 4
Lock
Conversion
spid 115
UPDATE orders
SET status = 1
WHERE id > 1
AND id < 3
spid 162
Lock will be blocked!
UPDATE
PHASE
X
U
S
S U X
X
X
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Why don’t you LOCK OFF!
Its obvious why developers (wrongly) use NOLOCK for
performance but…
• No Isolation guarantees since resource locks not placed meaning
dirty reads (and the other bad dependencies)
• Allocation order scan can result in
• Duplicate reads
• Unstable reads (error 601: “Could not continue scan with NOLOCK
due to data movement”
• READPAST hint is a better alternative but returns potentially
incomplete data sets
• What about Optimistic Concurrency?
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Row Versioning
1 2
1 4 B 9910
1 6 A 9925
UPDATE… x=6
UPDATE… x=4
COMMIT
UPDATE… x=2
COMMIT
Version created on
statement execution not
transaction commit.
Pointer XSN
14 Bytes
Row
Version
Version
Row data
T1
T2
T3
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
• SI provides isolation at the transaction level, RCS provides
isolation at the statement level
• SI must be explicitly SET in each connection, for RCS it becomes
the new default
• Enabling SI level requires no active transactions in order to
transition. Enabling RCS requires Exclusive Transaction Workspace
lock (and therefore no other connections to DB)
• RCS not allowed on master, tempdb and msdb, SI is allowed
• SI implements automatic update conflict detection
Read Committed Snapshot vs Snapshot Isolation
READPAST & Furious: In defence of being Pessimistic · Mark
Broadbent · sqlcloud.co.uk
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Optimistic Concurrency #FAIL
• Snapshot Isolation introduces
• Update conflicts! (not quite true)
• Causal*1 isolation behaviours and no serializable guarantees
• TempDB version-store overhead
• Increased IOPS for version creation
• Tree Traversal
• Long running transactions cause large version chains
• Writers use e(X)clusive locks
• Still block writers
• Could still escalate
• Page Fragmentation and 14 byte version pointer
• Readers should be short lived (in default isolation)
• Locks taken row-by-row, read and released
• OLTP loads are not read based (if you are doing it right!)
*1 At least that is what I
believe it is called (i.e. causal
consistency).
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
In-Memory Isolation
• Supports only SNAPSHOT, REPEATABLE READ and SERIALIZABLE
• Long running transactions consume more memory for in-memory
versions
• Cross disk/ in-memory table transactions are supported but only
for:
• READCOMMITTED + in-memory SNAPSHOT
• READCOMMITTED + in-memory REPEATABLEREAD/ SERIALIZABLE
• REPEATABLEREAD/ SERIALIZABLE + in-memory SNAPSHOT
• Are synchronization issues for:
• SNAPSHOT + in-memory any isolation
• REPEATABLEREAD/ SERIALIZABLE
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Demo
Optimistic isolation
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Are you Pessimistic about being Optimistic?
• Being pessimistic means that “I expect lots of contention, I must
prevent concurrent access.”
• Being optimistic means: “I do not expect resource contention, so
lets not overburden the system with concurrency controls.”
Consider:
• Proper use of indexing strategy
• Keep Transactions short lived
• Avoid escalation (in the wrong situation)
• Avoid higher ISOLATION LEVELS
• Make an intelligent use of SQL Server Scalability
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
In Summary…
• Interleaving and concurrent execution is why isolation is required
• Static read-only data does not require isolation
• Isolation and bad dependencies determined by the ISOLATION Level
• NOLOCK is ALMOST never a good idea… EVER
• RCSI is perhaps the best optimistic compromise but has overheads
• Snapshot Isolation is conceptually a perfect Isolation level but
practically dangerous because It DOES NOT offer SERIALIZABLE
protection
• Optimistic isolation is not a silver bullet for Concurrency
Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk
Thank you for listening!
Email: mark.broadbent@sqlcambs.org.uk
Twitter: retracement
Blog: http://tenbulls.co.uk

Weitere ähnliche Inhalte

Was ist angesagt?

(BDT323) Amazon EBS & Cassandra: 1 Million Writes Per Second
(BDT323) Amazon EBS & Cassandra: 1 Million Writes Per Second(BDT323) Amazon EBS & Cassandra: 1 Million Writes Per Second
(BDT323) Amazon EBS & Cassandra: 1 Million Writes Per SecondAmazon Web Services
 
VMware compute driver for OpenStack
VMware compute driver for OpenStackVMware compute driver for OpenStack
VMware compute driver for OpenStackopenstackindia
 
MySQL Database Architectures - 2020-10
MySQL Database Architectures -  2020-10MySQL Database Architectures -  2020-10
MySQL Database Architectures - 2020-10Kenny Gryp
 
DevCloud - Setup and Demo on Apache CloudStack
DevCloud - Setup and Demo on Apache CloudStack DevCloud - Setup and Demo on Apache CloudStack
DevCloud - Setup and Demo on Apache CloudStack buildacloud
 
Kubernetes on Top of Mesos on Top of DCOS
Kubernetes on Top of Mesos on Top of DCOSKubernetes on Top of Mesos on Top of DCOS
Kubernetes on Top of Mesos on Top of DCOSStefan Schimanski
 
Azure File Share and File Sync guide (Beginners Edition)
Azure File Share and File Sync guide (Beginners Edition)Azure File Share and File Sync guide (Beginners Edition)
Azure File Share and File Sync guide (Beginners Edition)Naseem Khoodoruth
 
Hypervisor Selection in CloudStack and OpenStack
Hypervisor Selection in CloudStack and OpenStackHypervisor Selection in CloudStack and OpenStack
Hypervisor Selection in CloudStack and OpenStackTim Mackey
 
Welcome to MySQL
Welcome to MySQLWelcome to MySQL
Welcome to MySQLGrigale LTD
 
CloudStack Day Japan 2015 - Hypervisor Selection in CloudStack 4.5
CloudStack Day Japan 2015 - Hypervisor Selection in CloudStack 4.5CloudStack Day Japan 2015 - Hypervisor Selection in CloudStack 4.5
CloudStack Day Japan 2015 - Hypervisor Selection in CloudStack 4.5Tim Mackey
 
Building and deploying a distributed application with Docker, Mesos and Marathon
Building and deploying a distributed application with Docker, Mesos and MarathonBuilding and deploying a distributed application with Docker, Mesos and Marathon
Building and deploying a distributed application with Docker, Mesos and MarathonJulia Mateo
 
Cloud stack troubleshooting
Cloud stack troubleshooting Cloud stack troubleshooting
Cloud stack troubleshooting AlexTian
 
Container Orchestration @Docker Meetup Hamburg
Container Orchestration @Docker Meetup HamburgContainer Orchestration @Docker Meetup Hamburg
Container Orchestration @Docker Meetup HamburgTimo Derstappen
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group ReplicationManish Kumar
 
Build a Docker Swarm cluster on Azure
Build a Docker Swarm cluster on Azure Build a Docker Swarm cluster on Azure
Build a Docker Swarm cluster on Azure Julien Maitrehenry
 
Oracle database on Docker Container
Oracle database on Docker ContainerOracle database on Docker Container
Oracle database on Docker ContainerJesus Guzman
 
Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...
Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...
Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...Severalnines
 
Virtual Router in CloudStack 4.4
Virtual Router in CloudStack 4.4Virtual Router in CloudStack 4.4
Virtual Router in CloudStack 4.4Sheng Yang
 

Was ist angesagt? (20)

(BDT323) Amazon EBS & Cassandra: 1 Million Writes Per Second
(BDT323) Amazon EBS & Cassandra: 1 Million Writes Per Second(BDT323) Amazon EBS & Cassandra: 1 Million Writes Per Second
(BDT323) Amazon EBS & Cassandra: 1 Million Writes Per Second
 
Quick and Solid - Baremetal on OpenStack | Rico Lin
Quick and Solid - Baremetal on OpenStack | Rico LinQuick and Solid - Baremetal on OpenStack | Rico Lin
Quick and Solid - Baremetal on OpenStack | Rico Lin
 
Docker Swarm scheduling in 1.12
Docker Swarm scheduling in 1.12Docker Swarm scheduling in 1.12
Docker Swarm scheduling in 1.12
 
VMware compute driver for OpenStack
VMware compute driver for OpenStackVMware compute driver for OpenStack
VMware compute driver for OpenStack
 
MySQL Database Architectures - 2020-10
MySQL Database Architectures -  2020-10MySQL Database Architectures -  2020-10
MySQL Database Architectures - 2020-10
 
DevCloud - Setup and Demo on Apache CloudStack
DevCloud - Setup and Demo on Apache CloudStack DevCloud - Setup and Demo on Apache CloudStack
DevCloud - Setup and Demo on Apache CloudStack
 
Mastering VMware Datacenter Part-1
Mastering VMware Datacenter Part-1Mastering VMware Datacenter Part-1
Mastering VMware Datacenter Part-1
 
Kubernetes on Top of Mesos on Top of DCOS
Kubernetes on Top of Mesos on Top of DCOSKubernetes on Top of Mesos on Top of DCOS
Kubernetes on Top of Mesos on Top of DCOS
 
Azure File Share and File Sync guide (Beginners Edition)
Azure File Share and File Sync guide (Beginners Edition)Azure File Share and File Sync guide (Beginners Edition)
Azure File Share and File Sync guide (Beginners Edition)
 
Hypervisor Selection in CloudStack and OpenStack
Hypervisor Selection in CloudStack and OpenStackHypervisor Selection in CloudStack and OpenStack
Hypervisor Selection in CloudStack and OpenStack
 
Welcome to MySQL
Welcome to MySQLWelcome to MySQL
Welcome to MySQL
 
CloudStack Day Japan 2015 - Hypervisor Selection in CloudStack 4.5
CloudStack Day Japan 2015 - Hypervisor Selection in CloudStack 4.5CloudStack Day Japan 2015 - Hypervisor Selection in CloudStack 4.5
CloudStack Day Japan 2015 - Hypervisor Selection in CloudStack 4.5
 
Building and deploying a distributed application with Docker, Mesos and Marathon
Building and deploying a distributed application with Docker, Mesos and MarathonBuilding and deploying a distributed application with Docker, Mesos and Marathon
Building and deploying a distributed application with Docker, Mesos and Marathon
 
Cloud stack troubleshooting
Cloud stack troubleshooting Cloud stack troubleshooting
Cloud stack troubleshooting
 
Container Orchestration @Docker Meetup Hamburg
Container Orchestration @Docker Meetup HamburgContainer Orchestration @Docker Meetup Hamburg
Container Orchestration @Docker Meetup Hamburg
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group Replication
 
Build a Docker Swarm cluster on Azure
Build a Docker Swarm cluster on Azure Build a Docker Swarm cluster on Azure
Build a Docker Swarm cluster on Azure
 
Oracle database on Docker Container
Oracle database on Docker ContainerOracle database on Docker Container
Oracle database on Docker Container
 
Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...
Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...
Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...
 
Virtual Router in CloudStack 4.4
Virtual Router in CloudStack 4.4Virtual Router in CloudStack 4.4
Virtual Router in CloudStack 4.4
 

Ähnlich wie lock, block & two smoking barrels

Persistence Is Futile - Implementing Delayed Durability
Persistence Is Futile - Implementing Delayed DurabilityPersistence Is Futile - Implementing Delayed Durability
Persistence Is Futile - Implementing Delayed DurabilityMark Broadbent
 
Welcome to the nightmare of locking, blocking and isolation levels!
Welcome to the nightmare of locking, blocking and isolation levels!Welcome to the nightmare of locking, blocking and isolation levels!
Welcome to the nightmare of locking, blocking and isolation levels!Boris Hristov
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMark Swarbrick
 
Troubleshooting Deadlocks in SQL Server 2000
Troubleshooting Deadlocks in SQL Server 2000Troubleshooting Deadlocks in SQL Server 2000
Troubleshooting Deadlocks in SQL Server 2000elliando dias
 
Using Edition-Based Redefinition for Zero Downtime PL/SQL Changes
Using Edition-Based Redefinition for Zero Downtime PL/SQL ChangesUsing Edition-Based Redefinition for Zero Downtime PL/SQL Changes
Using Edition-Based Redefinition for Zero Downtime PL/SQL ChangesChris Saxon
 
Replication Tips & Trick for SMUG
Replication Tips & Trick for SMUGReplication Tips & Trick for SMUG
Replication Tips & Trick for SMUGMats Kindahl
 
The Nightmare of Locking, Blocking and Isolation Levels!
The Nightmare of Locking, Blocking and Isolation Levels!The Nightmare of Locking, Blocking and Isolation Levels!
The Nightmare of Locking, Blocking and Isolation Levels!Boris Hristov
 
O Mundo Oracle e o Que Há de Novo no Java
O Mundo Oracle e o Que Há de Novo no JavaO Mundo Oracle e o Que Há de Novo no Java
O Mundo Oracle e o Que Há de Novo no JavaBruno Borges
 
Java è il linguaggio dell’IoT - Weaver
Java è il linguaggio dell’IoT - WeaverJava è il linguaggio dell’IoT - Weaver
Java è il linguaggio dell’IoT - WeaverCodemotion
 
MySQL For Linux Sysadmins
MySQL For Linux SysadminsMySQL For Linux Sysadmins
MySQL For Linux SysadminsMorgan Tocker
 
Welcome to the nightmare of locking, blocking and isolation levels!
Welcome to the nightmare of locking, blocking and isolation levels!Welcome to the nightmare of locking, blocking and isolation levels!
Welcome to the nightmare of locking, blocking and isolation levels!Boris Hristov
 
PL/SQL All the Things in Oracle SQL Developer
PL/SQL All the Things in Oracle SQL DeveloperPL/SQL All the Things in Oracle SQL Developer
PL/SQL All the Things in Oracle SQL DeveloperJeff Smith
 
Tweet4Beer - Beertap powered by Java goes IoT and JavaFX
Tweet4Beer - Beertap powered by Java goes IoT and JavaFXTweet4Beer - Beertap powered by Java goes IoT and JavaFX
Tweet4Beer - Beertap powered by Java goes IoT and JavaFXBruno Borges
 
10 Building Blocks for Enterprise JavaScript
10 Building Blocks for Enterprise JavaScript10 Building Blocks for Enterprise JavaScript
10 Building Blocks for Enterprise JavaScriptGeertjan Wielenga
 
Power of linked list
Power of linked listPower of linked list
Power of linked listPeter Hlavaty
 
Experiences of SOACS
Experiences of SOACSExperiences of SOACS
Experiences of SOACSSimon Haslam
 
The Nightmare of Locking, Blocking and Isolation Levels!
The Nightmare of Locking, Blocking and Isolation Levels!The Nightmare of Locking, Blocking and Isolation Levels!
The Nightmare of Locking, Blocking and Isolation Levels!Boris Hristov
 

Ähnlich wie lock, block & two smoking barrels (20)

Persistence Is Futile - Implementing Delayed Durability
Persistence Is Futile - Implementing Delayed DurabilityPersistence Is Futile - Implementing Delayed Durability
Persistence Is Futile - Implementing Delayed Durability
 
Welcome to the nightmare of locking, blocking and isolation levels!
Welcome to the nightmare of locking, blocking and isolation levels!Welcome to the nightmare of locking, blocking and isolation levels!
Welcome to the nightmare of locking, blocking and isolation levels!
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
 
Troubleshooting Deadlocks in SQL Server 2000
Troubleshooting Deadlocks in SQL Server 2000Troubleshooting Deadlocks in SQL Server 2000
Troubleshooting Deadlocks in SQL Server 2000
 
Using Edition-Based Redefinition for Zero Downtime PL/SQL Changes
Using Edition-Based Redefinition for Zero Downtime PL/SQL ChangesUsing Edition-Based Redefinition for Zero Downtime PL/SQL Changes
Using Edition-Based Redefinition for Zero Downtime PL/SQL Changes
 
Replication Tips & Trick for SMUG
Replication Tips & Trick for SMUGReplication Tips & Trick for SMUG
Replication Tips & Trick for SMUG
 
The Nightmare of Locking, Blocking and Isolation Levels!
The Nightmare of Locking, Blocking and Isolation Levels!The Nightmare of Locking, Blocking and Isolation Levels!
The Nightmare of Locking, Blocking and Isolation Levels!
 
O Mundo Oracle e o Que Há de Novo no Java
O Mundo Oracle e o Que Há de Novo no JavaO Mundo Oracle e o Que Há de Novo no Java
O Mundo Oracle e o Que Há de Novo no Java
 
Developer day v2
Developer day v2Developer day v2
Developer day v2
 
Java è il linguaggio dell’IoT - Weaver
Java è il linguaggio dell’IoT - WeaverJava è il linguaggio dell’IoT - Weaver
Java è il linguaggio dell’IoT - Weaver
 
MySQL For Linux Sysadmins
MySQL For Linux SysadminsMySQL For Linux Sysadmins
MySQL For Linux Sysadmins
 
Welcome to the nightmare of locking, blocking and isolation levels!
Welcome to the nightmare of locking, blocking and isolation levels!Welcome to the nightmare of locking, blocking and isolation levels!
Welcome to the nightmare of locking, blocking and isolation levels!
 
MySQL Replication
MySQL ReplicationMySQL Replication
MySQL Replication
 
PL/SQL All the Things in Oracle SQL Developer
PL/SQL All the Things in Oracle SQL DeveloperPL/SQL All the Things in Oracle SQL Developer
PL/SQL All the Things in Oracle SQL Developer
 
Tweet4Beer - Beertap powered by Java goes IoT and JavaFX
Tweet4Beer - Beertap powered by Java goes IoT and JavaFXTweet4Beer - Beertap powered by Java goes IoT and JavaFX
Tweet4Beer - Beertap powered by Java goes IoT and JavaFX
 
10 Building Blocks for Enterprise JavaScript
10 Building Blocks for Enterprise JavaScript10 Building Blocks for Enterprise JavaScript
10 Building Blocks for Enterprise JavaScript
 
Power of linked list
Power of linked listPower of linked list
Power of linked list
 
Experiences of SOACS
Experiences of SOACSExperiences of SOACS
Experiences of SOACS
 
The Nightmare of Locking, Blocking and Isolation Levels!
The Nightmare of Locking, Blocking and Isolation Levels!The Nightmare of Locking, Blocking and Isolation Levels!
The Nightmare of Locking, Blocking and Isolation Levels!
 
Secure pl-sql-coding
Secure pl-sql-codingSecure pl-sql-coding
Secure pl-sql-coding
 

Mehr von Mark Broadbent

Being Buck Woody - PASS Summit 2014 Edition
Being Buck Woody - PASS Summit 2014 EditionBeing Buck Woody - PASS Summit 2014 Edition
Being Buck Woody - PASS Summit 2014 EditionMark Broadbent
 
Enter The Dragon - SQL 2014 on Server Core - SQLSaturday #341 Porto Edition
Enter The Dragon - SQL 2014 on Server Core - SQLSaturday #341 Porto EditionEnter The Dragon - SQL 2014 on Server Core - SQLSaturday #341 Porto Edition
Enter The Dragon - SQL 2014 on Server Core - SQLSaturday #341 Porto EditionMark Broadbent
 
SQL Server AlwaysOn for Dummies SQLSaturday #202 Edition
SQL Server AlwaysOn for Dummies SQLSaturday #202 EditionSQL Server AlwaysOn for Dummies SQLSaturday #202 Edition
SQL Server AlwaysOn for Dummies SQLSaturday #202 EditionMark Broadbent
 
Moves Like Jagger - Upgrading to SQL Server 2012 (SQLBits XI Edition)
Moves Like Jagger - Upgrading to SQL Server 2012 (SQLBits XI Edition)Moves Like Jagger - Upgrading to SQL Server 2012 (SQLBits XI Edition)
Moves Like Jagger - Upgrading to SQL Server 2012 (SQLBits XI Edition)Mark Broadbent
 
SQLSaturday #188 Lisbon - READPAST & Furious: Transactions, Locking and Isola...
SQLSaturday #188 Lisbon - READPAST & Furious: Transactions, Locking and Isola...SQLSaturday #188 Lisbon - READPAST & Furious: Transactions, Locking and Isola...
SQLSaturday #188 Lisbon - READPAST & Furious: Transactions, Locking and Isola...Mark Broadbent
 
READPAST & Furious - Transactions, Locking and Isolation. PASS Summit 2012 Ed...
READPAST & Furious - Transactions, Locking and Isolation. PASS Summit 2012 Ed...READPAST & Furious - Transactions, Locking and Isolation. PASS Summit 2012 Ed...
READPAST & Furious - Transactions, Locking and Isolation. PASS Summit 2012 Ed...Mark Broadbent
 
PASS 2012 "Moves Like Jagger" - Upgrading to SQL Server 2012
PASS 2012 "Moves Like Jagger" - Upgrading to SQL Server 2012PASS 2012 "Moves Like Jagger" - Upgrading to SQL Server 2012
PASS 2012 "Moves Like Jagger" - Upgrading to SQL Server 2012Mark Broadbent
 
READPAST & Furious: Locking
READPAST & Furious: Locking READPAST & Furious: Locking
READPAST & Furious: Locking Mark Broadbent
 
SQL Server Clustering for Dummies
SQL Server Clustering for DummiesSQL Server Clustering for Dummies
SQL Server Clustering for DummiesMark Broadbent
 
Orders of-magnitude-scale-out-your-sql-server-data-slideshare
Orders of-magnitude-scale-out-your-sql-server-data-slideshareOrders of-magnitude-scale-out-your-sql-server-data-slideshare
Orders of-magnitude-scale-out-your-sql-server-data-slideshareMark Broadbent
 
Thinking outside the box, learning a little about a lot
Thinking outside the box, learning a little about a lotThinking outside the box, learning a little about a lot
Thinking outside the box, learning a little about a lotMark Broadbent
 

Mehr von Mark Broadbent (11)

Being Buck Woody - PASS Summit 2014 Edition
Being Buck Woody - PASS Summit 2014 EditionBeing Buck Woody - PASS Summit 2014 Edition
Being Buck Woody - PASS Summit 2014 Edition
 
Enter The Dragon - SQL 2014 on Server Core - SQLSaturday #341 Porto Edition
Enter The Dragon - SQL 2014 on Server Core - SQLSaturday #341 Porto EditionEnter The Dragon - SQL 2014 on Server Core - SQLSaturday #341 Porto Edition
Enter The Dragon - SQL 2014 on Server Core - SQLSaturday #341 Porto Edition
 
SQL Server AlwaysOn for Dummies SQLSaturday #202 Edition
SQL Server AlwaysOn for Dummies SQLSaturday #202 EditionSQL Server AlwaysOn for Dummies SQLSaturday #202 Edition
SQL Server AlwaysOn for Dummies SQLSaturday #202 Edition
 
Moves Like Jagger - Upgrading to SQL Server 2012 (SQLBits XI Edition)
Moves Like Jagger - Upgrading to SQL Server 2012 (SQLBits XI Edition)Moves Like Jagger - Upgrading to SQL Server 2012 (SQLBits XI Edition)
Moves Like Jagger - Upgrading to SQL Server 2012 (SQLBits XI Edition)
 
SQLSaturday #188 Lisbon - READPAST & Furious: Transactions, Locking and Isola...
SQLSaturday #188 Lisbon - READPAST & Furious: Transactions, Locking and Isola...SQLSaturday #188 Lisbon - READPAST & Furious: Transactions, Locking and Isola...
SQLSaturday #188 Lisbon - READPAST & Furious: Transactions, Locking and Isola...
 
READPAST & Furious - Transactions, Locking and Isolation. PASS Summit 2012 Ed...
READPAST & Furious - Transactions, Locking and Isolation. PASS Summit 2012 Ed...READPAST & Furious - Transactions, Locking and Isolation. PASS Summit 2012 Ed...
READPAST & Furious - Transactions, Locking and Isolation. PASS Summit 2012 Ed...
 
PASS 2012 "Moves Like Jagger" - Upgrading to SQL Server 2012
PASS 2012 "Moves Like Jagger" - Upgrading to SQL Server 2012PASS 2012 "Moves Like Jagger" - Upgrading to SQL Server 2012
PASS 2012 "Moves Like Jagger" - Upgrading to SQL Server 2012
 
READPAST & Furious: Locking
READPAST & Furious: Locking READPAST & Furious: Locking
READPAST & Furious: Locking
 
SQL Server Clustering for Dummies
SQL Server Clustering for DummiesSQL Server Clustering for Dummies
SQL Server Clustering for Dummies
 
Orders of-magnitude-scale-out-your-sql-server-data-slideshare
Orders of-magnitude-scale-out-your-sql-server-data-slideshareOrders of-magnitude-scale-out-your-sql-server-data-slideshare
Orders of-magnitude-scale-out-your-sql-server-data-slideshare
 
Thinking outside the box, learning a little about a lot
Thinking outside the box, learning a little about a lotThinking outside the box, learning a little about a lot
Thinking outside the box, learning a little about a lot
 

Kürzlich hochgeladen

Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 

Kürzlich hochgeladen (20)

Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 

lock, block & two smoking barrels

  • 1. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Mark Broadbent Principal Consultant SQLCloud SQLCLOUD.CO.UK lock, lockb& two smoking barrels
  • 2. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk About Mark Broadbent. “30 billion times more intelligent than a live mattress” Microsoft Certified Master/ Certified Solutions Master: SQL Server Owner/ Principal at SQLCloud Email: mark.broadbent@sqlcambs.org.uk Twitter: retracement Blog: http://tenbulls.co.uk Event Lead to the UK’s first ever SQLSaturday (Cambridge) and Cambridgeshire SQL Usergroup Event #3 on 10/ 11/ 12th Sept 2015 (pre-cons & Community day) http://sqlcambs.org.uk
  • 3. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Agenda Versioning Theory 1 Isolation 2 5 X X Locking X No Locking The best part of the presentation… Gin O‘Clock 4 3 6
  • 4. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk A C I D
  • 5. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Concurrency-versus-Correctness “ I s o l a t i o n i s a b a l a n c e b e t w e e n c o n c u r r e n c y a n d c o r r e c t n e s s ” – Me *1 1st law of Concurrency Control: Concurrent execution should not cause application programs to malfunction. 2nd law of Concurrency Control: Concurrent execution should not have lower throughput or much higher response times than serial execution. – Jim Gray and Andreas Reuter *1 derived from the writings of Gray, Reuter, Bernstein et.al
  • 6. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Serial Processing Read R1 Read R2 Write R3 T1 Read R1 Read R2 Write R3 T2 Read R4 Write R4 T3 Read R4 Write R4 T4
  • 7. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Transaction Interleaving T1 Read R1 T1 Read R2 T1 Write R3 T2 Read R1 T2 Read R2 T2 Write R3 T3 Read R4 T3 Write R4 T4 Read R4 T4 Write R3 T1 Read R1 T1 Read R2 T2 Read R1 T2 Read R2 T1 Write R3 T2 Write R3 T3 Read R4 T3 Write R4 T4 Read R4 T4 Write R3 T2 Read R1 T2 Read R2 T2 Write R3 T1 Read R1 T1 Read R2 T1 Write R3 T4 Read R4 T4 Write R3 T3 Read R4 T3 Write R4 T1 Read R1 T1 Read R2 T2 Read R1 T2 Read R2 T2 Write R3 T1 Write R3 T3 Read R4 T3 Write R4 T4 Read R4 T4 Write R4 T1 Read R1 T1 Read R2 T2 Read R1 T2 Read R2 T1 Write R3 T2 Write R3 T3 Read R4 T4 Read R4 T3 Write R4 T4 Write R4
  • 8. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Transactional Histories T1 Read R1 T1 Read R2 T2 Read R1 T2 Read R2 T1 Write R3 T2 Write R3 T3 Read R4 T4 Read R4 T3 Write R4 T4 Write R4 T1 SLOCK R1 T1 Read R1 T1 UNLOCK R1 T1 SLOCK R2 T2 SLOCK R1 T2 Read R1 T1 Read R2 T2 UNLOCK R1 T2 SLOCK R2 T2 Read R2 T1 UNLOCK R2 T2 UNLOCK R2 T1 XLOCK R3 T1 Write R3 T1 UNLOCK R3 T2 XLOCK R3 T2 Write R3 T2 UNLOCK R3 A transaction is considered Two- Phased if all LOCK actions precede an UNLOCK action A transaction is considered to be Well-Formed if all READ, WRITE and UNLOCK operations are covered by a preceding LOCK. Isolation mechanism has “serialized these transactional writes to same resource
  • 9. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk SERIALIZABLE 4 None WRITE  WRITE WRITE  READ READ  WRITE LOWEST: read and write locks held to EOT Isolation Levels READ UNCOMMITTED 1 “Bad Dependencies”Isolation Level Dirty Read, Non-Repeatable Read, Phantoms, Lost Updates X Dependencies WRITE  WRITE Concurrency GOOD: only wait on write-write locks READ COMMITTED 2 Non-Repeatable Read, Phantoms , Lost Updates WRITE  WRITE READ  WRITE WRITE  READ OK: wait on both but only writes held to EOT REPEATABLE READ 3 Phantoms WRITE  WRITE READ  WRITE WRITE  READ LOW: read and write locks held to EOT READ COMMITTED (with Snapshot Isolation) 2 Non-Repeatable Read, Phantoms , Lost Updates WRITE  WRITE GOOD: only wait on writes held to EOT SNAPSHOT 5 None (though Causal consistency concerns, lost update prevention and other behaviours) WRITE  WRITE GOOD: only wait on writes held to EOT
  • 10. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Isolation Levels… • Attempt to solve reduce interleaving dependency problems • 4 Levels are defined standard by ANSI, SQL 2005+ introduces 5th • Pessimistic concurrency readers block writers, writers block readers • Optimistic concurrency isolates the writes from the reads but not writes from writes • Not all Isolation Levels can be used everywhere – FILESTREAM enabled databases support only RC, RCS and SSI • Set at session level, transaction level and statement • Sometimes used behind the covers (such as Readable Secondaries)
  • 11. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Read Committed Lost Updates DECLARE @basketcount INT = 1 DECLARE @newquantity INT BEGIN TRANSACTION SELECT @newquantity = quantity FROM GunInventory WITH (NOLOCK) WHERE id = 1 SET @newquantity = @newquantity - @basketcount UPDATE GunInventory SET quantity = @newquantity WHERE id = 1 COMMIT
  • 12. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Demo Pessimistic isolation
  • 13. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Locks • Are compatible OR incompatible with each other • Are ONLY memory structures (lock blocks) and long chains can consume a lot of memory • Compared by lock manager across same resource or lock partition • Isolation determines their existence, granularity and duration • They can be converted or escalated • Poor queries cause less granular locks or escalation of locks • For performance and memory savings • Increases chances of blocking and deadlocks which cause perceived OR actual poor performance! • Is why developers love NOLOCK DBA-309
  • 14. Mark Broadbent · https://twitter.com/retracement · mark.broadbent@sqlcloud.co.uk · http://tenbulls.co.uk X IS IU SIU SIX UIX BU RS-S RS-U RI-N RI-S RI-U RI-X RX-U RX-X IX RX-S U S SCH-M SCH-S NL NL SCH-S SCH-M S U X IS IU SIU SIX UIX BU RS-S RS-U RI-N RI-S RI-U RI-X RX-S RX-U RX-XIX Compatible Incompatible Illegal NL SCH-S SCH-M S U X IS IU No Lock Schema Stability Lock Schema Modification Lock Shared Update Exclusive Intent Shared Intent Update IX SIU SIX UIX BU RS-S RS-U RI-N Intent Exclusive Share with Intent Update Share with Intent Exclusive Update with Intent Exclusive Bulk Update Shared Range-Shared Shared Range-Update Insert Range-Null RI-S RI-U RI-X RX-S RX-U RX-X Insert Range-Shared Insert Range-Update Insert Range-Exclusive Exclusive Range-Shared Exclusive Range-Update Exclusive Range-Exclusive SQL Server Lock Compatibility Chart
  • 15. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Granularity and Escalation Free Space Data Page IX Partition orders Table X X Row IX
  • 16. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Granularity and Escalation Free Space Data Page Partition orders Table Row ALTER <table> SET (LOCK_ESCALATION = auto| table| disable) Don’t escalate by TF1211 or take artificial IS on table Ignore # locks by TF1224 X
  • 17. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk orders id status 1 0 2 2 3 1 4 0 (U)pdate lock …a special kind of lock UPDATE orders SET status = 1 WHERE id > 1 AND id < 4 spid 115 UPDATE orders SET status = 1 WHERE id > 1 AND id < 3 spid 162 Lock will be blocked! SEARCH PHASE X U S S U X
  • 18. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk orders id status 1 0 2 2 3 1 4 0 (U)pdate lock …a special kind of lock UPDATE orders SET status = 1 WHERE id > 1 AND id < 4 Lock Conversion spid 115 UPDATE orders SET status = 1 WHERE id > 1 AND id < 3 spid 162 Lock will be blocked! UPDATE PHASE X U S S U X X X
  • 19. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Why don’t you LOCK OFF! Its obvious why developers (wrongly) use NOLOCK for performance but… • No Isolation guarantees since resource locks not placed meaning dirty reads (and the other bad dependencies) • Allocation order scan can result in • Duplicate reads • Unstable reads (error 601: “Could not continue scan with NOLOCK due to data movement” • READPAST hint is a better alternative but returns potentially incomplete data sets • What about Optimistic Concurrency?
  • 20. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Row Versioning 1 2 1 4 B 9910 1 6 A 9925 UPDATE… x=6 UPDATE… x=4 COMMIT UPDATE… x=2 COMMIT Version created on statement execution not transaction commit. Pointer XSN 14 Bytes Row Version Version Row data T1 T2 T3
  • 21. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk • SI provides isolation at the transaction level, RCS provides isolation at the statement level • SI must be explicitly SET in each connection, for RCS it becomes the new default • Enabling SI level requires no active transactions in order to transition. Enabling RCS requires Exclusive Transaction Workspace lock (and therefore no other connections to DB) • RCS not allowed on master, tempdb and msdb, SI is allowed • SI implements automatic update conflict detection Read Committed Snapshot vs Snapshot Isolation READPAST & Furious: In defence of being Pessimistic · Mark Broadbent · sqlcloud.co.uk
  • 22. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Optimistic Concurrency #FAIL • Snapshot Isolation introduces • Update conflicts! (not quite true) • Causal*1 isolation behaviours and no serializable guarantees • TempDB version-store overhead • Increased IOPS for version creation • Tree Traversal • Long running transactions cause large version chains • Writers use e(X)clusive locks • Still block writers • Could still escalate • Page Fragmentation and 14 byte version pointer • Readers should be short lived (in default isolation) • Locks taken row-by-row, read and released • OLTP loads are not read based (if you are doing it right!) *1 At least that is what I believe it is called (i.e. causal consistency).
  • 23. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk In-Memory Isolation • Supports only SNAPSHOT, REPEATABLE READ and SERIALIZABLE • Long running transactions consume more memory for in-memory versions • Cross disk/ in-memory table transactions are supported but only for: • READCOMMITTED + in-memory SNAPSHOT • READCOMMITTED + in-memory REPEATABLEREAD/ SERIALIZABLE • REPEATABLEREAD/ SERIALIZABLE + in-memory SNAPSHOT • Are synchronization issues for: • SNAPSHOT + in-memory any isolation • REPEATABLEREAD/ SERIALIZABLE
  • 24. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Demo Optimistic isolation
  • 25. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Are you Pessimistic about being Optimistic? • Being pessimistic means that “I expect lots of contention, I must prevent concurrent access.” • Being optimistic means: “I do not expect resource contention, so lets not overburden the system with concurrency controls.” Consider: • Proper use of indexing strategy • Keep Transactions short lived • Avoid escalation (in the wrong situation) • Avoid higher ISOLATION LEVELS • Make an intelligent use of SQL Server Scalability
  • 26. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk In Summary… • Interleaving and concurrent execution is why isolation is required • Static read-only data does not require isolation • Isolation and bad dependencies determined by the ISOLATION Level • NOLOCK is ALMOST never a good idea… EVER • RCSI is perhaps the best optimistic compromise but has overheads • Snapshot Isolation is conceptually a perfect Isolation level but practically dangerous because It DOES NOT offer SERIALIZABLE protection • Optimistic isolation is not a silver bullet for Concurrency
  • 27. Copyright © 2014, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk Thank you for listening! Email: mark.broadbent@sqlcambs.org.uk Twitter: retracement Blog: http://tenbulls.co.uk