From 58094f9604400010e5d84a90d91c2ac4129fe015 Mon Sep 17 00:00:00 2001 From: boris Date: Tue, 30 Jan 2024 13:27:57 +0000 Subject: [PATCH] vault backup: 2024-01-30 13:27:56 --- .obsidian/workspace.json | 17 +++---- .../Week 3/Week 3 Database Systems.md | 46 +++++++++++++++++++ 2 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 Semester 2/Database Systems/Week 3/Week 3 Database Systems.md diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 728d15c..8880b5e 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -6,6 +6,7 @@ { "id": "f52c29341d47e672", "type": "tabs", + "dimension": 85.46511627906976, "children": [ { "id": "d9a3d1a4a3f2cc4d", @@ -13,7 +14,7 @@ "state": { "type": "markdown", "state": { - "file": "Semester 2/Database Systems/Week 2/Week 2 Database Systems.md", + "file": "Semester 2/Database Systems/Week 3/Week 3 Database Systems.md", "mode": "source", "source": false } @@ -24,6 +25,7 @@ { "id": "7b5e68cfd661dd0d", "type": "tabs", + "dimension": 14.534883720930234, "children": [ { "id": "505b4bbc8a7e15f6", @@ -102,7 +104,7 @@ "state": { "type": "backlink", "state": { - "file": "Semester 2/Database Systems/Week 2/Week 2 Database Systems.md", + "file": "Semester 2/Database Systems/Week 3/Week 3 Database Systems.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -119,7 +121,7 @@ "state": { "type": "outgoing-link", "state": { - "file": "Semester 2/Database Systems/Week 2/Week 2 Database Systems.md", + "file": "Semester 2/Database Systems/Week 3/Week 3 Database Systems.md", "linksCollapsed": false, "unlinkedCollapsed": true } @@ -142,7 +144,7 @@ "state": { "type": "outline", "state": { - "file": "Semester 2/Database Systems/Week 2/Week 2 Database Systems.md" + "file": "Semester 2/Database Systems/Week 3/Week 3 Database Systems.md" } } }, @@ -184,9 +186,11 @@ }, "active": "d9a3d1a4a3f2cc4d", "lastOpenFiles": [ - "images/Pasted image 20240126103004.png", "Semester 2/Database Systems/Exercise Booklet.pdf", + "Semester 2/Database Systems/Week 3/Week 3 Database Systems.md", "Semester 2/Database Systems/Week 2/Week 2 Database Systems.md", + "Semester 2/Database Systems/Week 3", + "images/Pasted image 20240126103004.png", "images/Pasted image 20240126102902.png", "images/Pasted image 20240126101454.png", "images/Pasted image 20240126101407.png", @@ -206,10 +210,8 @@ "Semester 2/Computer Systems Internals & Linux/Week 2/media/freeimage-7063371.jpg", "Semester 2/Computer Systems Internals & Linux/Week 2/media/freeimage-5931627.jpg", "Semester 2/Computer Systems Internals & Linux/Week 2/media/freeimage-216999.jpg", - "Semester 2/Computer Systems Internals & Linux/Week 2/media/freeimage-1967619.jpg", "Semester 2/Computer Systems Internals & Linux/Week 2/media/footsteps_forest_01.mp3", "Semester 2/Computer Systems Internals & Linux/Week 2/media/firework_fountain_sparks_crackle.mp3", - "Semester 2/Computer Systems Internals & Linux/Week 2/media/dentist_drill_working_on_tooth.mp3", "Semester 2/Database Systems/Week 1/Week 1 Database Systems.md", "Semester 1/Database Systems/Week 10/Week 10 Database Systems.md", "Semester 2/Computer Systems Internals & Linux/Week 1/Week 2 Computer Systems Internals.md", @@ -229,7 +231,6 @@ "2024-01-15.md", "Semester 1/Database Systems/Week 9/Week 9 Database Systems.md", "Semester 1/Database Systems/Week 8/Week 8 Database Systems.md", - "Semester 1/Database Systems/Week 7/Week 7 Database Systems.md", "Database Systems/Untitled.canvas", "Untitled 1.canvas", "Untitled.canvas" diff --git a/Semester 2/Database Systems/Week 3/Week 3 Database Systems.md b/Semester 2/Database Systems/Week 3/Week 3 Database Systems.md new file mode 100644 index 0000000..0819311 --- /dev/null +++ b/Semester 2/Database Systems/Week 3/Week 3 Database Systems.md @@ -0,0 +1,46 @@ +# Online Transaction Processing Systems + +Systems that need real time support for querying and updating of databases by one or more concurrent users. + +Data is updated in real time frequently, but must maintain correctness of the database state regardless of hardware and software failures, and multiple users accessing said data. + +## Examples of OLTPs + +- Banking / Credit Card processing systems +- Transport reservation systems +- Trading / Brokerage systems +- E-commerce + +### Example 1 + +- Two students registering for the same class ( Student Enrolment Database ) + +NumEnroled = 39 +MaxEnroled = 40 + +If two students attempt to enrol at the same time, NumEnroled = 41, which is in an inconsistent state, violating semantic constraints, when processing requests from multiple concurrent users. + +### Example 2 + +- Two people attempt to withdraw from two different ATMs in a joint account +- Person A withdraws £100 at ATM 1 +- Person B withdraws £50 from ATM 2 +- Initial balance £400 + +Final balance should be £250 no matter who withdraws first. +However, if they withdraw at the same time, the final balance would be £300 OR £350, depending on various attributes of the ATMs ( physical location, processing speed, current load, etc. ), as £400 total balance would be reported to both ATMs + +## Challenges of OLTP + +Although the AQL code is written correctly, the database may be in an inconsistent state after processing transactions due to failures of hard / software / multiple users accessing the db. +A consistent state of the database means it satisfied all the constraints specified in the schema ( overall description of the database: pk, fk, referential integrity, etc. ), and any other constraints on the database that should hold ( eg. semantic constraints. ) + +# Transaction + +An action / series of actions, carried out by a single user or application program that reads or updates the contents of the database. +- A transaction is treated as a logical unit of work on the database. This may be + - An entire program + - Part of a program + - A single statement + +