Posgres Concurrency Notes: 1

T1:                           
BEGIN
S1
S2 T2:
S3 UP1
COMMIT
S4
COMMIT
BEGIN;
SELECT hits FROM webpages WHERE url = ’…’;
— client internally computes $newval = $hits + 1
UPDATE webpages SET hits = $newval WHERE url = ’…’;
COMMIT;
BEGIN; 
SELECT hits FROM webpages WHERE url = ’…’;
UPDATE webpages SET hits = hits + 1 WHERE url = ’…’;
COMMIT;
BEGIN; 
UPDATE my accounts SET balance = balance - $withdrawal WHERE accountid = ’checking’;
SELECT SUM(balance) FROM my accounts;
if (sum > = 1000.00)
COMMIT;
else
ROLLBACK;

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Python-Examples

What’s the difference between software architecture and design?

LETS MAKE IT EASY TO LEARN “PYTHON””

INTRO TO C++: Controlling the Flow of a Program — Using For Loop, While Loops, Do-While and Switch…

Everything you should know about QA in software development: The beginner’s guide

Laravel Tutorial ~ Laravel Eloquent Relationships

Should you take the DevOps-as-a-Service route?

A circle with a finger at the center, pointing the culmination of development(dev) and operations(IT ops) teams.

How to Get Started with Contributing to Open Source

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
none

none

More from Medium

Deploy your Java Lambda easily with Microlam!

Debugging heavy load on Oracle databases

Reduce Your Energy Bills using MongoDB — Part 1 Monitoring Power Usage

Hitchhikers Guide to Software Tool Names