Databases and Database Programming. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University

Size: px
Start display at page:

Download "Databases and Database Programming. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University"

Transcription

1 Databases and Database Programming Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University 1

2 Objectives You will learn about: Databases and database management systems Transactions SQL and SQLite Database programming in Java and Python Relational database design Beyond relational databases (if time) 2

3 Objectives Note: Comprehensive coverage is impossible! Please supplement with the reading 3

4 Agenda DBs and DBMSs Transactions SQL and SQLite DB programming in Java and Python Relational DB design Beyond relational DBs (if time) 4

5 DB and DBMS Some definitions... Database (DB) A structured collection of data An abstract view of a file or collection of files stored persistently (disk, flash drive, ) 5

6 DB and DBMS Database management system (DBMS) Software that maintains a database Usually, a server Listens on a known host at a known port Clients contact server to perform queries and updates 6

7 Motivation for DB and DBMS Question: Why not simply use files? Answer: Centralized control Database administrators (DBAs) control the data 7

8 Motivation for DB and DBMS A good DBMS used by good DBAs can: Reduce redundancy Avoid inconsistencies Facilitate data sharing Enforce standards Apply security restrictions Maintain integrity Balance conflicting requirements Insure safety (backups) An Introduction to Database Systems, C. J. Date 8

9 Types of DBs In historical order... Navigational DBs Relational DBs 9

10 Navigational DBs Data are linked into tree or network/graph structure User/program is given root node User/program follows links to desired data Example: 10

11 Example Navigational DB BOOKS isbn title quantity ORDERS custid quantity author AUTHORS CUSTOMERS custname street zipcode ZIPCODES city state 11

12 Example Nav DB Query Which customers purchased the book whose ISBN is 123? BOOKS (isbn, title, quantity) 123 The Practice of Programming 500 ORDERS (custid, quantity) CUSTOMERS (custname, street, zipcode) Princeton 114 Nassau St Harvard 1256 Mass Ave

13 Navigational DB Limitations In the example: Good: Given book, easy to find customers Bad: Given customer, hard to find books In general: Queries are biased DB designer must anticipate queries to create appropriate links 13

14 Relational DBs Who: Edgar Codd When: Where: IBM What: Applied some mathematics Eliminate all links!!! 14

15 Relational DB Structure Relational database structure Formally: Database consists of relations which have tuples and attributes Informally: Database consists of tables which have rows and columns Example... 15

16 Relational DBs BOOKS isbn title quantity 123 The Practice of Programming The C Programming Language Algorithms in C 650 ORDERS isbn custid quantity AUTHORS isbn author 123 Kernighan 123 Pike 234 Kernighan 234 Ritchie 345 Sedgewick CUSTOMERS custid custname street zipcode 111 Princeton 114 Nassau St Harvard 1256 Mass Ave MIT 292 Main St ZIPCODES zipcode city state Princeton NJ Cambridge MA Cambridge MA 16

17 Relational DBs No links Queries are unbiased However: DBA can create links (indices), based upon anticipated usage patterns DBMS can create links (indices), based upon observed usage patterns Today, relational DBs are (still!) the most popular kind 17

18 Agenda DBs and DBMSs Transactions SQL and SQLite DB programming in Java and Python Relational DB design Beyond relational DBs (if time) 18

19 Motivation for Transactions Problem 1: Recovery DBMS must recover from HW/SW failures Problem 2: Concurrency DBMS must handle updates from multiple concurrent clients Both problems are solved by transactions 19

20 Problem 1: Recovery Recovery DBMS must recover from HW/SW failures DBMS must preserve DB consistency in the presence of HW/SW failures 20

21 Problem 1: Recovery Example: Customer 222 has purchased 1 copy of book 123 Must change ORDERS: add 1 to quantity of appropriate row Must change BOOKS: subtract 1 from quantity of appropriate row 21

22 Problem 1: Recovery Time Increment quantity of the ORDERS row whose isbn is 123 and custid is 222 Decrement quantity of the BOOKS row whose isbn is 123 HW/SW error DB becomes inconsistent!!! 22

23 Solution 1: Transactions Transaction A logical unit of work A sequence of operations that the DBMS performs atomically DBMS executes all or none of the operations Transforms DB from one consistent state to another Without necessarily preserving consistency at intermediate points 23

24 Solution 1: Transactions Pattern: (1) Execute BEGIN stmt to begin transaction (2) Perform update(s) (3) Execute: COMMIT stmt to commit updates to DB and end transaction, or ROLLBACK stmt to discard updates and end transaction 24

25 Solution 1: Transactions BEGIN Time Increment quantity of the ORDERS row whose isbn is 123 and custid is 222 HW/SW error Decrement quantity of the BOOKS row whose isbn is 123 COMMIT DBMS rolls back first update DB remains consistent 25

26 Problem 2: Concurrency Concurrency Multiple processes may access DB concurrently DBMS must maintain DB consistency in the presence of concurrent updates 26

27 Problem 2: Concurrency Time Process A Fetch row R (quan=100) quan+=5 Update row R (quan=105) Process B Fetch row R (quan=100) quan+=5 Update row R (quan=105) Process A's update is lost; DB is inconsistent 27

28 Solution 2: Transactions Transaction A recovery mechanism (as previously described), and A locking mechanism Oversimplification... Process can ask DBMS to lock DB rows that are involved in active transaction Other processes cannot access locked DB rows 28

29 Solution 2: Transactions Time Process A BEGIN Fetch row R (quan=100) Acquire lock on R quan += 5 Update row R (quan=105) COMMIT Release lock on R BEGIN Process B Fetch row R (quan=105) Acquire lock on R Fetch row R (quan=105) Acquire lock on R quan += 5 Update row R (quan=110) COMMIT Release lock on R B cannot access row R until A commits 29

30 The ACID Test DBMS transaction mechanism must pass the ACID test Atomicity: each transaction must complete or rollback completely Consistency: each transaction must not violate any consistency constraints (see later this lecture) Isolation: transactions should not interfere with each other; same results if transactions are executed sequentially or in parallel Durability: once committed, transaction remains persistent even if HW/SW failures occur 30

31 Agenda DBs and DMBSs Transactions SQL and SQLite DB programming in Java and Python Relational DB design Beyond relational DBs (if time) 31

32 SQL Who: Donald Chamberlin & Raymond Boyce When: 1970s Where: IBM Why: Manipulate data in IBM s System R relational DBMS 32

33 SQL SQL Structured Query Language Has been standardized ISO/IEC :2008 Now the de facto standard for communicating with relational DBMSs 33

34 SQLite Who: D. Richard Hipp When: 2000 Where: General Dynamics Why: Eliminate distinct DBMS process, eliminate DBAs 34

35 SQLite SQLite A popular free relational DBMS Uses SQL (no surprise!) Extends SQL with additional statements As DBMSs typically do Lightweight (no surprise!) Good choice for learning SQL 35

36 Typical DBMS Structure Application program Socket DBMS program File I/O Data store DBMS is a program App pgm & DBMS pgm run in distinct processes App process & DBMS process communicate via sockets (see upcoming Networks lecture) 36

37 SQLite Structure Application program SQLite module File I/O Data store DBMS is a module App pgm & DBMS module run in same process App pgm & DBMS module communicate via function/method calls 37

38 Using the SQLite Client SQLite command-line client From a courselab shell prompt: sqlite3 filename Uses existing database filename, or Creates database filename Example: sqlite3 bookstore.sqlite Type SQLite/SQL statements at sqlite> prompt 38

39 Using the SQLite Client Suggestion: Install SQLite command-line client on your computer Mac and MS Windows Download from Linux Use package mgr to install sqlite3 (or similarly named) package 39

40 SQLite/SQL Statements SQLite statements Begin with. Keywords are case sensitive Standard SQL statements Do not begin with. Keywords are case insensitive Must end with semicolon 40

41 SQLite: Fundamentals.help.help.quit.quit.tables.tables.schema [table].schema.schema books 41

42 SQLite Data Types Some SQLite data types: SQLite Java Python INTEGER int or long int REAL double float TEXT String unicode BLOB Object object NULL type null type NoneType 42

43 SQLite: Reading/Writing.read file.read bookstore.sql.output file.output xxx.sql Subsequent dump goes to file.dump.dump 43

44 SQL: Creating/Destroying Tables DROP TABLE [IF EXISTS] table; drop table books; CREATE TABLE [IF NOT EXISTS] table (column datatype, ); CREATE TABLE books (isbn TEXT, title TEXT, quantity INTEGER); 44

45 SQL: Altering Table Schema ALTER TABLE table specification [, specification] ; ALTER TABLE books ADD price INTEGER FIRST; ALTER TABLE books ADD pages INTEGER AFTER quantity; ALTER TABLE books DROP price, DROP pages; ALTER TABLE table ADD INDEX(column); ALTER TABLE books ADD INDEX (isbn); Enables fast search on isbn column Matters for large tables (see COS 333 assignments) 45

46 SQL: Selecting Table Data SELECT expr, FROM table, [WHERE condition] [ORDER BY column [ASC DESC]]; SELECT * FROM books; SELECT * FROM authors; SELECT * FROM customers; SELECT * FROM orders; SELECT * FROM zipcodes; SELECT isbn, title FROM books; SELECT * FROM books ORDER BY quantity DESC; Note: Result is a table 46

47 SQL: Selecting Table Data SELECT * FROM books WHERE quantity = 650; SELECT * FROM books WHERE quantity >= 650; SELECT * FROM orders SELECT * FROM orders WHERE isbn = 123 AND custid = 222; SELECT * FROM orders WHERE isbn = 123 OR custid = 222; SELECT * FROM books WHERE title LIKE 'The%'; SELECT * FROM books WHERE title LIKE '%of%'; SELECT * FROM books WHERE title LIKE 't_e%'; Note: Result is a table 47

48 SQL: Selecting Table Data SELECT books.title, authors.author from books, authors; Cartesian product; 15 rows, but only 5 are meaningful! SELECT books.title, authors.author from books, authors WHERE books.isbn = authors.isbn; SELECT title, author from books, authors WHERE books.isbn = authors.isbn; SELECT custname, title, orders.quantity FROM books, customers, orders WHERE books.isbn = orders.isbn AND orders.custid = customers.custid; Note: Result is a table 48

49 SQL: Changing Table Data INSERT INTO table (column, ) VALUES (expr, ); INSERT INTO books (isbn, title, quantity) VALUES('456', 'Core Java', 120); DELETE FROM table [WHERE condition]; DELETE FROM books; -- Be careful!!! DELETE FROM books WHERE title LIKE 'The%'; UPDATE table SET column1=expr1 [, column2=expr2 ] [WHERE condition]; UPDATE books SET quantity=60 WHERE isbn=123; UPDATE books SET quantity=quantity+1 WHERE isbn=123; 49

50 SQL: Transactions BEGIN; Begins a transaction COMMIT; Commits and ends the active transaction ROLLBACK; Rolls back and ends the active transaction 50

51 UPDATE books SET quantity = WHERE isbn = 123;.quit SQL: Transactions BEGIN; UPDATE books SET quantity = WHERE isbn = 123;.quit BEGIN; UPDATE books SET quantity = WHERE isbn = 123; COMMIT;.quit BEGIN; UPDATE books SET quantity = WHERE isbn = 123; ROLLBACK;.quit 51

52 Agenda DBs and DBMSs Transactions SQL and SQLite DB programming in Java and Python Relational DB design Beyond relational DBs (if time) 52

53 Database Drivers Program must use a database driver to communicate with DBMS Program Database driver DBMS 53

54 Java Database Drivers Generally: Java program JDBC interface DBMS-specific impl Socket Database protocol DBMS File I/O Data store 54

55 Java Database Drivers Example: Java program JDBC interface Oracle JDBC impl Socket Oracle protocol Oracle DBMS File I/O Data store 55

56 Java SQLite Database Driver In our case: Java program JDBC interface sqlite-jdbc.jar SQLite protocol SQLite DBMS File I/O Data store sqlite-jdbc.jar must be in CLASSPATH 56

57 Python Database Drivers Generally: Python program DBAPI DBMS-specific impl Socket Database protocol DBMS File I/O Data store 57

58 Python Database Drivers Example: Python program DBAPI Oracle DBAPI impl Socket Oracle protocol Oracle DBMS File I/O Data store 58

59 Python SQLite Database Driver In our case: Python program DBAPI sqlite3 SQLite protocol SQLite DBMS File I/O Data store sqlite3 module must be installed 59

60 AuthorSearch Programs Illustrate: Database connectivity Execution of SELECT statements Handling of result tables 60

61 AuthorSearch in Java See AuthorSearch.java Accessing a SQLite database Use of cursor to iterate over result table 61

62 AuthorSearch in Python See authorsearch.py Accessing a SQLite database Use of cursor to iterate over result table Cursor provides each row as list 62

63 AuthorSearch in Python Commentary In relational model, columns are (in principle) unordered Don t execute SELECT * from code Python sqlite3 module should provide each row as a dict, not a list 63

64 Purchase Programs Illustrate: Database connectivity Execution of UPDATE statements Transactions 64

65 Purchase in Java See Purchase.java Execution of UPDATE statements Transactions connection.setautocommit(false); Commands connection not to automatically commit after each update Program must explicitly commit First update implicitly begins a transaction connection.commit() Commits and ends transaction 65

66 Purchase in Python See purchase.py Execution of UPDATE statements Transactions First update implicitly begins a transaction connection.commit() Commits and ends transaction 66

67 Recovery Programs Illustrate: Using transactions for recovery See Recovery.java, recovery.py Error occurs at unpredictable time between updates Database consistency is preserved 67

68 SQL Injection Attacks The problem (via an example)... Consider this SQL statement from AuthorSearch programs: SELECT books.isbn, title, quantity FROM books, authors WHERE books.isbn = authors.isbn AND author = 'someauthor' 68

69 SQL Injection Attacks Suppose (malicious?) user provides this someauthor: junk' OR 'x'='x 69

70 SQL Injection Attacks SELECT books.isbn, title, quantity FROM books, authors WHERE books.isbn = authors.isbn AND author = 'someauthor' junk' OR 'x'='x SELECT books.isbn, title, quantity FROM books, authors WHERE books.isbn = authors.isbn AND author = 'junk' OR 'x'='x' Note: AND has higher precedence than OR 70

71 SQL Injection Attacks Resulting statement: Selects all rows of Cartesian product Accesses data that user is not authorized to access??? Causes denial-of-service??? Implements a SQL injection attack 71

72 SQL Injection Attacks The problem (via another example)... Consider this SQL statement from Purchase programs: UPDATE orders SET quantity = quantity+1 WHERE isbn = someisbn AND custid = somecustid 72

73 SQL Injection Attacks Suppose (malicious?) user provides this someisbn 123 and this somecustid: 222 OR 'x'='x' 73

74 SQL Injection Attacks UPDATE orders SET quantity = quantity+1 WHERE isbn = someisbn AND custid = somecustid OR 'x'='x UPDATE orders SET quantity = quantity+1 WHERE isbn = 123 AND custid = 222 OR 'x'='x' Note: AND has higher precedence than OR 74

75 SQL Injection Attacks Resulting statement: Updates all rows of ORDERS table Corrupts the DB!!! Implements a SQL injection attack For more examples: 75

76 Prepared Statements A solution... Prepared statements Program commands driver to compile SQL statement, with placeholders Program sends user data to driver Driver populates placeholders with user data SQL statement parsing is unrelated to user data E.g. Presence of OR in user data does not affect parsing 76

77 Prepared Pgms Illustrate: Prepared statements See AuthorSearchPrepared.java See authorsearchprepared.py See PurchasePrepared.java See purchaseprepared.py Prepared statements prohibit SQL injection attacks Always use prepared statements 77

78 Agenda DBs and DBMSs Transactions SQL and SQLite DB programming in Java and Python Relational DB design Beyond relational DBs (if time) 78

79 Example Database DB0 Design: BOOKS: isbn, title, authors, quantity ORDERS: isbn, custid, custname, street, city, state, zipcode, quantity 79

80 Example data: Example Database DB0 BOOKS isbn title authors quantity 123 The Practice of Programming {Kernighan Pike} The C Programming Language {Kernighan Ritchie} Algorithms in C Sedgewick 650 ORDERS isbn custid custname street city state zipcode quantity Harvard 1256 Mass Ave Cambridge MA Harvard 1256 Mass Ave Cambridge MA Princeton 114 Nassau St Princeton NJ

81 Normal Forms Observation: Design seems wrong Note redundancy Can we be more formal? Are there rules that we can apply to: Determine that the design is wrong? Make it right? 81

82 Normal Forms Database researchers have developed theories to help DBAs: Develop right designs, or... Consciously decide to use a wrong design In particular, Codd proposed 3 normal forms 82

83 First Normal Form Informally... Def: A table is in first normal form iff each column contains only atomic values 83

84 DB0 Not in First Normal Form BOOKS isbn title authors quantity 123 The Practice of Programming {Kernighan Pike} The C Programming Language {Kernighan Ritchie} Algorithms in C Sedgewick 650 ORDERS isbn custid custname street city state zipcode quantity Harvard 1256 Mass Ave Cambridge MA Harvard 1256 Mass Ave Cambridge MA Princeton 114 Nassau St Princeton NJ

85 Example Database DB1 Design BOOKS: isbn, title, quantity AUTHORS: isbn, author ORDERS: isbn, custid, custname, street, city, state, zipcode,quantity 85

86 Example Database DB1 Example data: BOOKS isbn title quantity 123 The Practice of Programming The C Programming Language Algorithms in C 650 AUTHORS isbn author 123 Kernighan 123 Pike 234 Kernighan 234 Ritchie 345 Sedgewick ORDERS isbn custid custname street city state zipcode quantity Harvard 1256 Mass Ave Cambridge MA Harvard 1256 Mass Ave Cambridge MA Princeton 114 Nassau St Princeton NJ

87 Candidate Keys Def: A candidate key for a table is a minimal set of columns that uniquely identifies any particular row of that table 87

88 Candidate Keys in DB1 Candidate keys: BOOKS isbn title quantity 123 The Practice of Programming The C Programming Language Algorithms in C 650 AUTHORS isbn author 123 Kernighan 123 Pike 234 Kernighan 234 Ritchie 345 Sedgewick ORDERS isbn custid custname street city state zipcode quantity Harvard 1256 Mass Ave Cambridge MA Harvard 1256 Mass Ave Cambridge MA Princeton 114 Nassau St Princeton NJ

89 Primary Keys Def: We choose one candidate key to be the primary key of the table; the others are called alternate keys of the table In DB1: Each table has only one candidate key It s obvious which candidate key to choose as the primary key 89

90 Functional Dependence Def: A column C2 of a table is functionally dependent on a column C1 iff, for each row in the table, the value of C1 determines the value of C2 In DB

91 DB1 Functional Dependencies BOOKS isbn title quantity AUTHORS isbn author ORDERS quantity isbn custid custname street zipcode city state 91

92 Second Normal Form Informally... A table is in second normal form iff: It is in first normal form, and No non-candidate-key column is dependent on any proper subset of any candidate key 92

93 DB1 Not in Second Norm Form BOOKS isbn title quantity AUTHORS isbn author ORDERS quantity isbn custid custname street zipcode city state 93

94 Example Database DB2 Design BOOKS: isbn, title, quantity AUTHORS: isbn, author CUSTOMERS: custid, custname, street, city, state, zipcode ORDERS: isbn, custid, quantity 94

95 Example Database DB2 BOOKS isbn title quantity 123 The Practice of Programming The C Programming Language Algorithms in C 650 ORDERS isbn custid quantity AUTHORS isbn author 123 Kernighan 123 Pike 234 Kernighan 234 Ritchie 345 Sedgewick CUSTOMERS custid custname street city state zipcode 111 Princeton 114 Nassau St Princeton NJ Harvard 1256 Mass Ave Cambridge MA MIT 292 Main St Cambridge MA

96 DB2 in Second Norm Form BOOKS isbn title quantity AUTHORS isbn author ORDERS CUSTOMERS isbn custid quantity custid custname street city zipcode state 96

97 Third Normal Form Informally... A table is in third normal form iff: It is in second normal form, and Every non-candidate-key column is nontransitively dependent on the candidate keys 97

98 DB2 not in Third Norm Form BOOKS isbn title quantity AUTHORS isbn author ORDERS CUSTOMERS isbn custid quantity custid custname street city zipcode state 98

99 Example Database DB3 Design BOOKS: isbn, title, quantity AUTHORS: isbn, author CUSTOMERS: custid, custname, street, zipcode ZIPCODES: zipcode, city, state ORDERS: isbn, custid, quantity 99

100 Example Database DB3 BOOKS isbn title quantity 123 The Practice of Programming The C Programming Language Algorithms in C 650 ORDERS isbn custid quantity AUTHORS isbn author 123 Kernighan 123 Pike 234 Kernighan 234 Ritchie 345 Sedgewick CUSTOMERS custid custname street zipcode 111 Princeton 114 Nassau St Harvard 1256 Mass Ave MIT 292 Main St ZIPCODES zipcode city state Princeton NJ Cambridge MA Cambridge MA 100

101 DB3 in Third Norm Form BOOKS isbn title quantity AUTHORS isbn author CUSTOMERS custname custid street zipcode ORDERS isbn quantity custid ZIPCODES city zipcode state 101

102 Relational DB Design Wrap-Up Some additional points... Database designers routinely violate normal forms But a good one does so: Only with a purpose Knowing the consequences 102

103 Relational DB Design Wrap-Up DBMS can enforce additional consistency constraints; e.g.: Primary key values cannot be null Primary key values must be unique within a table Within a table, foreign key values must correspond to primary key values in another table E.g. orders.isbn is a foreign key with respect to books.isbn 103

104 Relational DB Design Wrap-Up There is a substantial mathematical theory of relational database design More precise definitions of normal forms Several additional normal forms Relational algebra, relational calculus Foreign keys, integrity rules... See An Introduction to Database Systems (C. J. Date) 104

105 Agenda DBs and DBMSs Transactions SQL and SQLite DB programming in Java and Python Relational DB design Beyond relational DBs (if time) 105

106 Relational DB Limitations Relational DBs: Create an impedence mismatch Relational data model (tables, rows, columns) differs from OOP data model (objects, object references, object composition, class inheritance) Awkward to map relational data to (software) objects (e.g., cursors) Object-relational mapping (ORM) software exists See 106

107 Relational DB Limitations Relational DBMSs: Often are more complex than necessary Many apps don t need query neutrality, strict ACID transactions, One size does not fit all 107

108 DB Data Models Data Model Relational Non-Relational (NoSQL) Key-Value Stores Document Stores Wide-Column Stores Some info for next 5 slides derived from 108

109 Key-Value Stores Key-value store Values: Arbitrary bytes Data structure: key-value pairs Persistent hash table, or search tree (for ordering) Simple; fast Examples: Redis, Memcached, Microsoft Azure Cosmos DB, Hazelcast, Ehcache 109

110 Document Stores Document store Values: Documents Documents sometimes have internal structure (e.g. JSON) which DBMS can process Data structure: key-value pairs Can access document by key or sometimes by content Examples: MongoDB, Amazon DynamoDB, Couchbase, CouchDB, MarkLogic 110

111 Wide-Column Stores Wide-column store Values: Arbitrary bytes Data structure: Multidimensional associative array Typically sparsely populated Origin: Google BigTable Examples: Cassandra, HBase, Microsoft Azure Cosmos DB 111

112 Popular DBMS and Data Models According to as of Sept 2017: Rank DBMS DB Data Model Score 1 Oracle Relational MySQL Relational Microsoft SQL Server Relational PostgreSQL Relational MongoDB Document Store DB2 Relational Microsoft Access Relational Cassandra Wide-Column Store Redis Key-Value Store SQLite Relational

113 DBMS Topologies Topology Centralized Distributed Shared Memory Shared Disk Shared Nothing 113

114 DBMS Topologies Centralized One DBMS process Distributed More than one DBMS process Shared memory Multiple DBMS processes share the same memory and file system Shared disk Multiple DBMS processes use distinct memory but share the same file system Shared nothing Multiple DBMS processes, each having its own distinct memory and file system Data is split or replicated across servers 114

115 The CAP Theorem Who: Eric Brewer Where: UC Berkeley When:

116 The CAP Theorem Desired qualities of a distributed sharednothing DBMS: Consistency: Every read from node Y receives the most recent write to node X Availability: Every read from node Y receives a response, but maybe not the most recent write to node X Partition tolerance: The system continues to have same behavior even if its nodes become partitioned 116

117 The CAP Theorem The CAP theorem It is impossible for a distributed data store to simultaneously provide more than 2 of those 3 qualities Any distributed DBMS must have P Any distributed DBMS cannot have both C and A 117

118 The CAP Theorem Node X Node Y write read User 1 User 2 Normal case User 1 writes to X X communicates change to Y User 2 reads from Y 118

119 The CAP Theorem Node X Node Y write read User 1 User 2 Suppose X and Y become partitioned Suppose we claim partition tolerance (P) 119

120 The CAP Theorem Node X Node Y write read User 1 User 2 Option 1: User 1 writes to X User 2 read from Y returns immediately Consistency (C)? No Availability (A)? Yes Partition tolerance (P)? Yes 120

121 The CAP Theorem Node X Node Y write read User 1 User 2 Option 2: User 1 writes to X User 2 read from Y blocks Consistency (C)? Yes Availability (A)? No Partition tolerance (P)? Yes 121

122 DBMS Topologies Topology Centralized Distributed Shared Memory Shared Disk Shared Nothing CP AP 122

123 DBMS Topologies Shared nothing CP AP Provide consistency and partition tolerance Goal: data quality (i.e. provide consistent data) Provide availability and partition tolerance Goal: data quantity (i.e. provide data quickly) 123

124 Model/Topology Summary DB data models Relational NoSQL Key-value store Document store Wide column store DBMS topologies Centralized Decentralized Shared memory Shared disk Shared nothing CP AP

125 Model/Topology Combinations Which model/topology combination would you use for: A small bank? A large bank? The Google search engine? 125

126 Model/Topology Combinations Some combinations of model + topology are difficult E.g.: relational + shared nothing Split vertically: OK Split horizontally & key identifies server: OK Split horizontally & key does not identify server (sharding): hard Motivation for NoSQL DBMSs 126

127 Summary We have covered... DBs and DBMSs Transactions SQL and SQLite DB programming in Java and Python Relational DB design Beyond relational DBs (if time) 127

Advanced Programming Techniques. Database Systems. Christopher Moretti

Advanced Programming Techniques. Database Systems. Christopher Moretti Advanced Programming Techniques Database Systems Christopher Moretti History Pre-digital libraries Organized by medium, size, shape, content, metadata Record managers (1800s-1950s) manually- indexed punched

More information

Topics. History. Architecture. MongoDB, Mongoose - RDBMS - SQL. - NoSQL

Topics. History. Architecture. MongoDB, Mongoose - RDBMS - SQL. - NoSQL Databases Topics History - RDBMS - SQL Architecture - SQL - NoSQL MongoDB, Mongoose Persistent Data Storage What features do we want in a persistent data storage system? We have been using text files to

More information

5/2/16. Announcements. NoSQL Motivation. The New Hipster: NoSQL. Serverless. What is the Problem? Database Systems CSE 414

5/2/16. Announcements. NoSQL Motivation. The New Hipster: NoSQL. Serverless. What is the Problem? Database Systems CSE 414 Announcements Database Systems CSE 414 Lecture 16: NoSQL and JSon Current assignments: Homework 4 due tonight Web Quiz 6 due next Wednesday [There is no Web Quiz 5 Today s lecture: JSon The book covers

More information

Database Systems CSE 414

Database Systems CSE 414 Database Systems CSE 414 Lecture 16: NoSQL and JSon CSE 414 - Spring 2016 1 Announcements Current assignments: Homework 4 due tonight Web Quiz 6 due next Wednesday [There is no Web Quiz 5] Today s lecture:

More information

CIB Session 12th NoSQL Databases Structures

CIB Session 12th NoSQL Databases Structures CIB Session 12th NoSQL Databases Structures By: Shahab Safaee & Morteza Zahedi Software Engineering PhD Email: safaee.shx@gmail.com, morteza.zahedi.a@gmail.com cibtrc.ir cibtrc cibtrc 2 Agenda What is

More information

10/18/2017. Announcements. NoSQL Motivation. NoSQL. Serverless Architecture. What is the Problem? Database Systems CSE 414

10/18/2017. Announcements. NoSQL Motivation. NoSQL. Serverless Architecture. What is the Problem? Database Systems CSE 414 Announcements Database Systems CSE 414 Lecture 11: NoSQL & JSON (mostly not in textbook only Ch 11.1) HW5 will be posted on Friday and due on Nov. 14, 11pm [No Web Quiz 5] Today s lecture: NoSQL & JSON

More information

Introduction to Databases, Fall 2005 IT University of Copenhagen. Lecture 10: Transaction processing. November 14, Lecturer: Rasmus Pagh

Introduction to Databases, Fall 2005 IT University of Copenhagen. Lecture 10: Transaction processing. November 14, Lecturer: Rasmus Pagh Introduction to Databases, Fall 2005 IT University of Copenhagen Lecture 10: Transaction processing November 14, 2005 Lecturer: Rasmus Pagh Today s lecture Part I: Transaction processing Serializability

More information

CSE 530A ACID. Washington University Fall 2013

CSE 530A ACID. Washington University Fall 2013 CSE 530A ACID Washington University Fall 2013 Concurrency Enterprise-scale DBMSs are designed to host multiple databases and handle multiple concurrent connections Transactions are designed to enable Data

More information

5/1/17. Announcements. NoSQL Motivation. NoSQL. Serverless Architecture. What is the Problem? Database Systems CSE 414

5/1/17. Announcements. NoSQL Motivation. NoSQL. Serverless Architecture. What is the Problem? Database Systems CSE 414 Announcements Database Systems CSE 414 Lecture 15: NoSQL & JSON (mostly not in textbook only Ch 11.1) 1 Homework 4 due tomorrow night [No Web Quiz 5] Midterm grading hopefully finished tonight post online

More information

CompSci 516 Database Systems

CompSci 516 Database Systems CompSci 516 Database Systems Lecture 20 NoSQL and Column Store Instructor: Sudeepa Roy Duke CS, Fall 2018 CompSci 516: Database Systems 1 Reading Material NOSQL: Scalable SQL and NoSQL Data Stores Rick

More information

Database Architectures

Database Architectures Database Architectures CPS352: Database Systems Simon Miner Gordon College Last Revised: 4/15/15 Agenda Check-in Parallelism and Distributed Databases Technology Research Project Introduction to NoSQL

More information

CMPT 354: Database System I. Lecture 11. Transaction Management

CMPT 354: Database System I. Lecture 11. Transaction Management CMPT 354: Database System I Lecture 11. Transaction Management 1 Why this lecture DB application developer What if crash occurs, power goes out, etc? Single user à Multiple users 2 Outline Transaction

More information

Data Base Concepts. Course Guide 2

Data Base Concepts. Course Guide 2 MS Access Chapter 1 Data Base Concepts Course Guide 2 Data Base Concepts Data The term data is often used to distinguish binary machine-readable information from textual human-readable information. For

More information

Rajiv GandhiCollegeof Engineering& Technology, Kirumampakkam.Page 1 of 10

Rajiv GandhiCollegeof Engineering& Technology, Kirumampakkam.Page 1 of 10 Rajiv GandhiCollegeof Engineering& Technology, Kirumampakkam.Page 1 of 10 RAJIV GANDHI COLLEGE OF ENGINEERING & TECHNOLOGY, KIRUMAMPAKKAM-607 402 DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING QUESTION BANK

More information

Relational databases

Relational databases COSC 6397 Big Data Analytics NoSQL databases Edgar Gabriel Spring 2017 Relational databases Long lasting industry standard to store data persistently Key points concurrency control, transactions, standard

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lecture 22: Transactions I CSE 344 - Fall 2014 1 Announcements HW6 due tomorrow night Next webquiz and hw out by end of the week HW7: Some Java programming required

More information

CMU SCS CMU SCS Who: What: When: Where: Why: CMU SCS

CMU SCS CMU SCS Who: What: When: Where: Why: CMU SCS Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB s C. Faloutsos A. Pavlo Lecture#23: Distributed Database Systems (R&G ch. 22) Administrivia Final Exam Who: You What: R&G Chapters 15-22

More information

Database Management Systems Introduction to DBMS

Database Management Systems Introduction to DBMS Database Management Systems Introduction to DBMS D B M G 1 Introduction to DBMS Data Base Management System (DBMS) A software package designed to store and manage databases We are interested in internal

More information

DATABASES SQL INFOTEK SOLUTIONS TEAM

DATABASES SQL INFOTEK SOLUTIONS TEAM DATABASES SQL INFOTEK SOLUTIONS TEAM TRAINING@INFOTEK-SOLUTIONS.COM Databases 1. Introduction in databases 2. Relational databases (SQL databases) 3. Database management system (DBMS) 4. Database design

More information

Distributed Data Store

Distributed Data Store Distributed Data Store Large-Scale Distributed le system Q: What if we have too much data to store in a single machine? Q: How can we create one big filesystem over a cluster of machines, whose data is

More information

CSC 261/461 Database Systems Lecture 20. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101

CSC 261/461 Database Systems Lecture 20. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101 CSC 261/461 Database Systems Lecture 20 Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101 Announcements Project 1 Milestone 3: Due tonight Project 2 Part 2 (Optional): Due on: 04/08 Project 3

More information

Introduction to Database Systems

Introduction to Database Systems Introduction to Database Systems Based on slides by Dan Suciu Adapted by Michael Hahsler 1 / 16 Database What is a database? Physical storage: A collection of files storing related data. Logical: A collection

More information

Webinar Series TMIP VISION

Webinar Series TMIP VISION Webinar Series TMIP VISION TMIP provides technical support and promotes knowledge and information exchange in the transportation planning and modeling community. Today s Goals To Consider: Parallel Processing

More information

Introduction to NoSQL Databases

Introduction to NoSQL Databases Introduction to NoSQL Databases Roman Kern KTI, TU Graz 2017-10-16 Roman Kern (KTI, TU Graz) Dbase2 2017-10-16 1 / 31 Introduction Intro Why NoSQL? Roman Kern (KTI, TU Graz) Dbase2 2017-10-16 2 / 31 Introduction

More information

Relational Database Systems Part 01. Karine Reis Ferreira

Relational Database Systems Part 01. Karine Reis Ferreira Relational Database Systems Part 01 Karine Reis Ferreira karine@dpi.inpe.br Aula da disciplina Computação Aplicada I (CAP 241) 2016 Database System Database: is a collection of related data. represents

More information

Database Systems CSE 414

Database Systems CSE 414 Database Systems CSE 414 Lecture 21: More Transactions (Ch 8.1-3) CSE 414 - Spring 2017 1 Announcements HW6 due on Today WQ7 (last!) due on Sunday HW7 will be posted tomorrow due on Wed, May 24 using JDBC

More information

Database Technology Introduction. Heiko Paulheim

Database Technology Introduction. Heiko Paulheim Database Technology Introduction Outline The Need for Databases Data Models Relational Databases Database Design Storage Manager Query Processing Transaction Manager Introduction to the Relational Model

More information

Large-Scale Key-Value Stores Eventual Consistency Marco Serafini

Large-Scale Key-Value Stores Eventual Consistency Marco Serafini Large-Scale Key-Value Stores Eventual Consistency Marco Serafini COMPSCI 590S Lecture 13 Goals of Key-Value Stores Export simple API put(key, value) get(key) Simpler and faster than a DBMS Less complexity,

More information

Introduction Aggregate data model Distribution Models Consistency Map-Reduce Types of NoSQL Databases

Introduction Aggregate data model Distribution Models Consistency Map-Reduce Types of NoSQL Databases Introduction Aggregate data model Distribution Models Consistency Map-Reduce Types of NoSQL Databases Key-Value Document Column Family Graph John Edgar 2 Relational databases are the prevalent solution

More information

Jargons, Concepts, Scope and Systems. Key Value Stores, Document Stores, Extensible Record Stores. Overview of different scalable relational systems

Jargons, Concepts, Scope and Systems. Key Value Stores, Document Stores, Extensible Record Stores. Overview of different scalable relational systems Jargons, Concepts, Scope and Systems Key Value Stores, Document Stores, Extensible Record Stores Overview of different scalable relational systems Examples of different Data stores Predictions, Comparisons

More information

Database Systems CSE 414

Database Systems CSE 414 Database Systems CSE 414 Lecture 22: Transaction Implementations CSE 414 - Spring 2017 1 Announcements WQ7 (last!) due on Sunday HW7: due on Wed, May 24 using JDBC to execute SQL from Java using SQL Server

More information

Introduction to Databases

Introduction to Databases Introduction to Databases Matthew J. Graham CACR Methods of Computational Science Caltech, 2009 January 27 - Acknowledgements to Julian Bunn and Ed Upchurch what is a database? A structured collection

More information

NoSQL systems. Lecture 21 (optional) Instructor: Sudeepa Roy. CompSci 516 Data Intensive Computing Systems

NoSQL systems. Lecture 21 (optional) Instructor: Sudeepa Roy. CompSci 516 Data Intensive Computing Systems CompSci 516 Data Intensive Computing Systems Lecture 21 (optional) NoSQL systems Instructor: Sudeepa Roy Duke CS, Spring 2016 CompSci 516: Data Intensive Computing Systems 1 Key- Value Stores Duke CS,

More information

CHAPTER 3 RECOVERY & CONCURRENCY ADVANCED DATABASE SYSTEMS. Assist. Prof. Dr. Volkan TUNALI

CHAPTER 3 RECOVERY & CONCURRENCY ADVANCED DATABASE SYSTEMS. Assist. Prof. Dr. Volkan TUNALI CHAPTER 3 RECOVERY & CONCURRENCY ADVANCED DATABASE SYSTEMS Assist. Prof. Dr. Volkan TUNALI PART 1 2 RECOVERY Topics 3 Introduction Transactions Transaction Log System Recovery Media Recovery Introduction

More information

Essential Skills - RDBMS and SQL

Essential Skills - RDBMS and SQL Essential Skills - RDBMS and SQL Essential Skills RDBMS and SQL Daniël van Eeden dveeden@snow.nl October 2011 What is a Database? A structured collection of data What is a DBMS DataBase Management System

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lecture 22: Transactions CSE 344 - Fall 2013 1 Announcements HW6 is due tonight Webquiz due next Monday HW7 is posted: Some Java programming required Plus connection

More information

CSE 344 JULY 9 TH NOSQL

CSE 344 JULY 9 TH NOSQL CSE 344 JULY 9 TH NOSQL ADMINISTRATIVE MINUTIAE HW3 due Wednesday tests released actual_time should have 0s not NULLs upload new data file or use UPDATE to change 0 ~> NULL Extra OOs on Mondays 5-7pm in

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lecture 21: More Transactions CSE 344 Fall 2015 1 Announcements Webquiz 7 is due before Thanksgiving HW7: Some Java programming required Plus connection to SQL Azure

More information

Lectures 8 & 9. Lectures 7 & 8: Transactions

Lectures 8 & 9. Lectures 7 & 8: Transactions Lectures 8 & 9 Lectures 7 & 8: Transactions Lectures 7 & 8 Goals for this pair of lectures Transactions are a programming abstraction that enables the DBMS to handle recoveryand concurrency for users.

More information

Cassandra, MongoDB, and HBase. Cassandra, MongoDB, and HBase. I have chosen these three due to their recent

Cassandra, MongoDB, and HBase. Cassandra, MongoDB, and HBase. I have chosen these three due to their recent Tanton Jeppson CS 401R Lab 3 Cassandra, MongoDB, and HBase Introduction For my report I have chosen to take a deeper look at 3 NoSQL database systems: Cassandra, MongoDB, and HBase. I have chosen these

More information

Introduction to Relational Databases

Introduction to Relational Databases Introduction to Relational Databases Third La Serena School for Data Science: Applied Tools for Astronomy August 2015 Mauro San Martín msmartin@userena.cl Universidad de La Serena Contents Introduction

More information

COURSE OVERVIEW THE RELATIONAL MODEL. CS121: Relational Databases Fall 2017 Lecture 1

COURSE OVERVIEW THE RELATIONAL MODEL. CS121: Relational Databases Fall 2017 Lecture 1 COURSE OVERVIEW THE RELATIONAL MODEL CS121: Relational Databases Fall 2017 Lecture 1 Course Overview 2 Introduction to relational database systems Theory and use of relational databases Focus on: The Relational

More information

User Perspective. Module III: System Perspective. Module III: Topics Covered. Module III Overview of Storage Structures, QP, and TM

User Perspective. Module III: System Perspective. Module III: Topics Covered. Module III Overview of Storage Structures, QP, and TM Module III Overview of Storage Structures, QP, and TM Sharma Chakravarthy UT Arlington sharma@cse.uta.edu http://www2.uta.edu/sharma base Management Systems: Sharma Chakravarthy Module I Requirements analysis

More information

Database Systems CSE 414

Database Systems CSE 414 Database Systems CSE 414 Lecture 27: Transaction Implementations 1 Announcements Final exam will be on Dec. 14 (next Thursday) 14:30-16:20 in class Note the time difference, the exam will last ~2 hours

More information

COURSE OVERVIEW THE RELATIONAL MODEL. CS121: Introduction to Relational Database Systems Fall 2016 Lecture 1

COURSE OVERVIEW THE RELATIONAL MODEL. CS121: Introduction to Relational Database Systems Fall 2016 Lecture 1 COURSE OVERVIEW THE RELATIONAL MODEL CS121: Introduction to Relational Database Systems Fall 2016 Lecture 1 Course Overview 2 Introduction to relational database systems Theory and use of relational databases

More information

5/17/17. Announcements. Review: Transactions. Outline. Review: TXNs in SQL. Review: ACID. Database Systems CSE 414.

5/17/17. Announcements. Review: Transactions. Outline. Review: TXNs in SQL. Review: ACID. Database Systems CSE 414. Announcements Database Systems CSE 414 Lecture 21: More Transactions (Ch 8.1-3) HW6 due on Today WQ7 (last!) due on Sunday HW7 will be posted tomorrow due on Wed, May 24 using JDBC to execute SQL from

More information

DATABASE SYSTEMS. Database programming in a web environment. Database System Course, 2016

DATABASE SYSTEMS. Database programming in a web environment. Database System Course, 2016 DATABASE SYSTEMS Database programming in a web environment Database System Course, 2016 AGENDA FOR TODAY Advanced Mysql More than just SELECT Creating tables MySQL optimizations: Storage engines, indexing.

More information

CSE 530A. Non-Relational Databases. Washington University Fall 2013

CSE 530A. Non-Relational Databases. Washington University Fall 2013 CSE 530A Non-Relational Databases Washington University Fall 2013 NoSQL "NoSQL" was originally the name of a specific RDBMS project that did not use a SQL interface Was co-opted years later to refer to

More information

CISC 7610 Lecture 5 Distributed multimedia databases. Topics: Scaling up vs out Replication Partitioning CAP Theorem NoSQL NewSQL

CISC 7610 Lecture 5 Distributed multimedia databases. Topics: Scaling up vs out Replication Partitioning CAP Theorem NoSQL NewSQL CISC 7610 Lecture 5 Distributed multimedia databases Topics: Scaling up vs out Replication Partitioning CAP Theorem NoSQL NewSQL Motivation YouTube receives 400 hours of video per minute That is 200M hours

More information

BIS Database Management Systems.

BIS Database Management Systems. BIS 512 - Database Management Systems http://www.mis.boun.edu.tr/durahim/ Ahmet Onur Durahim Learning Objectives Database systems concepts Designing and implementing a database application Life of a Query

More information

MIS Database Systems.

MIS Database Systems. MIS 335 - Database Systems http://www.mis.boun.edu.tr/durahim/ Ahmet Onur Durahim Learning Objectives Database systems concepts Designing and implementing a database application Life of a Query in a Database

More information

Administration Naive DBMS CMPT 454 Topics. John Edgar 2

Administration Naive DBMS CMPT 454 Topics. John Edgar 2 Administration Naive DBMS CMPT 454 Topics John Edgar 2 http://www.cs.sfu.ca/coursecentral/454/johnwill/ John Edgar 4 Assignments 25% Midterm exam in class 20% Final exam 55% John Edgar 5 A database stores

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Unit 7: Transactions Schedules Implementation Two-phase Locking (3 lectures) 1 Class Overview Unit 1: Intro Unit 2: Relational Data Models and Query Languages Unit

More information

Databases - Transactions

Databases - Transactions Databases - Transactions Gordon Royle School of Mathematics & Statistics University of Western Australia Gordon Royle (UWA) Transactions 1 / 34 ACID ACID is the one acronym universally associated with

More information

CSE 344 APRIL 16 TH SEMI-STRUCTURED DATA

CSE 344 APRIL 16 TH SEMI-STRUCTURED DATA CSE 344 APRIL 16 TH SEMI-STRUCTURED DATA ADMINISTRATIVE MINUTIAE HW3 due Wednesday OQ4 due Wednesday HW4 out Wednesday (Datalog) Exam May 9th 9:30-10:20 WHERE WE ARE So far we have studied the relational

More information

Weak Levels of Consistency

Weak Levels of Consistency Weak Levels of Consistency - Some applications are willing to live with weak levels of consistency, allowing schedules that are not serialisable E.g. a read-only transaction that wants to get an approximate

More information

Transactions. 1. Transactions. Goals for this lecture. Today s Lecture

Transactions. 1. Transactions. Goals for this lecture. Today s Lecture Goals for this lecture Transactions Transactions are a programming abstraction that enables the DBMS to handle recovery and concurrency for users. Application: Transactions are critical for users Even

More information

CPSC 421 Database Management Systems. Lecture 19: Physical Database Design Concurrency Control and Recovery

CPSC 421 Database Management Systems. Lecture 19: Physical Database Design Concurrency Control and Recovery CPSC 421 Database Management Systems Lecture 19: Physical Database Design Concurrency Control and Recovery * Some material adapted from R. Ramakrishnan, L. Delcambre, and B. Ludaescher Agenda Physical

More information

Transaction Management & Concurrency Control. CS 377: Database Systems

Transaction Management & Concurrency Control. CS 377: Database Systems Transaction Management & Concurrency Control CS 377: Database Systems Review: Database Properties Scalability Concurrency Data storage, indexing & query optimization Today & next class Persistency Security

More information

Goal of the presentation is to give an introduction of NoSQL databases, why they are there.

Goal of the presentation is to give an introduction of NoSQL databases, why they are there. 1 Goal of the presentation is to give an introduction of NoSQL databases, why they are there. We want to present "Why?" first to explain the need of something like "NoSQL" and then in "What?" we go in

More information

Chapter 2. DB2 concepts

Chapter 2. DB2 concepts 4960ch02qxd 10/6/2000 7:20 AM Page 37 DB2 concepts Chapter 2 Structured query language 38 DB2 data structures 40 Enforcing business rules 49 DB2 system structures 52 Application processes and transactions

More information

Distributed Data Management Transactions

Distributed Data Management Transactions Felix Naumann F-2.03/F-2.04, Campus II Hasso Plattner Institut must ensure that interactions succeed consistently An OLTP Topic Motivation Most database interactions consist of multiple, coherent operations

More information

Oral Questions and Answers (DBMS LAB) Questions & Answers- DBMS

Oral Questions and Answers (DBMS LAB) Questions & Answers- DBMS Questions & Answers- DBMS https://career.guru99.com/top-50-database-interview-questions/ 1) Define Database. A prearranged collection of figures known as data is called database. 2) What is DBMS? Database

More information

/ Cloud Computing. Recitation 6 October 2 nd, 2018

/ Cloud Computing. Recitation 6 October 2 nd, 2018 15-319 / 15-619 Cloud Computing Recitation 6 October 2 nd, 2018 1 Overview Announcements for administrative issues Last week s reflection OLI unit 3 module 7, 8 and 9 Quiz 4 Project 2.3 This week s schedule

More information

Chapter 8: Working With Databases & Tables

Chapter 8: Working With Databases & Tables Chapter 8: Working With Databases & Tables o Working with Databases & Tables DDL Component of SQL Databases CREATE DATABASE class; o Represented as directories in MySQL s data storage area o Can t have

More information

Distributed Non-Relational Databases. Pelle Jakovits

Distributed Non-Relational Databases. Pelle Jakovits Distributed Non-Relational Databases Pelle Jakovits Tartu, 7 December 2018 Outline Relational model NoSQL Movement Non-relational data models Key-value Document-oriented Column family Graph Non-relational

More information

1

1 1 2 3 6 7 8 9 10 Storage & IO Benchmarking Primer Running sysbench and preparing data Use the prepare option to generate the data. Experiments Run sysbench with different storage systems and instance

More information

Introduction to NoSQL

Introduction to NoSQL Introduction to NoSQL Agenda History What is NoSQL Types of NoSQL The CAP theorem History - RDBMS Relational DataBase Management Systems were invented in the 1970s. E. F. Codd, "Relational Model of Data

More information

NOSQL EGCO321 DATABASE SYSTEMS KANAT POOLSAWASD DEPARTMENT OF COMPUTER ENGINEERING MAHIDOL UNIVERSITY

NOSQL EGCO321 DATABASE SYSTEMS KANAT POOLSAWASD DEPARTMENT OF COMPUTER ENGINEERING MAHIDOL UNIVERSITY NOSQL EGCO321 DATABASE SYSTEMS KANAT POOLSAWASD DEPARTMENT OF COMPUTER ENGINEERING MAHIDOL UNIVERSITY WHAT IS NOSQL? Stands for No-SQL or Not Only SQL. Class of non-relational data storage systems E.g.

More information

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2015 Lecture 14 NoSQL

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2015 Lecture 14 NoSQL CSE 544 Principles of Database Management Systems Magdalena Balazinska Winter 2015 Lecture 14 NoSQL References Scalable SQL and NoSQL Data Stores, Rick Cattell, SIGMOD Record, December 2010 (Vol. 39, No.

More information

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data. Managing Data Data storage tool must provide the following features: Data definition (data structuring) Data entry (to add new data) Data editing (to change existing data) Querying (a means of extracting

More information

L i (A) = transaction T i acquires lock for element A. U i (A) = transaction T i releases lock for element A

L i (A) = transaction T i acquires lock for element A. U i (A) = transaction T i releases lock for element A Lock-Based Scheduler Introduction to Data Management CSE 344 Lecture 20: Transactions Simple idea: Each element has a unique lock Each transaction must first acquire the lock before reading/writing that

More information

Application development with relational and non-relational databases

Application development with relational and non-relational databases Application development with relational and non-relational databases Mario Lassnig European Organization for Nuclear Research (CERN) mario.lassnig@cern.ch About me Software Engineer Data Management for

More information

CA485 Ray Walshe NoSQL

CA485 Ray Walshe NoSQL NoSQL BASE vs ACID Summary Traditional relational database management systems (RDBMS) do not scale because they adhere to ACID. A strong movement within cloud computing is to utilize non-traditional data

More information

Final Exam Logistics. CS 133: Databases. Goals for Today. Some References Used. Final exam take-home. Same resources as midterm

Final Exam Logistics. CS 133: Databases. Goals for Today. Some References Used. Final exam take-home. Same resources as midterm Final Exam Logistics CS 133: Databases Fall 2018 Lec 25 12/06 NoSQL Final exam take-home Available: Friday December 14 th, 4:00pm in Olin Due: Monday December 17 th, 5:15pm Same resources as midterm Except

More information

CSE 190D Database System Implementation

CSE 190D Database System Implementation CSE 190D Database System Implementation Arun Kumar Topic 6: Transaction Management Chapter 16 of Cow Book Slide ACKs: Jignesh Patel 1 Transaction Management Motivation and Basics The ACID Properties Transaction

More information

Transactions and ACID

Transactions and ACID Transactions and ACID Kevin Swingler Contents Recap of ACID transactions in RDBMSs Transactions and ACID in MongoDB 1 Concurrency Databases are almost always accessed by multiple users concurrently A user

More information

CGS 3066: Spring 2017 SQL Reference

CGS 3066: Spring 2017 SQL Reference CGS 3066: Spring 2017 SQL Reference Can also be used as a study guide. Only covers topics discussed in class. This is by no means a complete guide to SQL. Database accounts are being set up for all students

More information

SCALABLE CONSISTENCY AND TRANSACTION MODELS

SCALABLE CONSISTENCY AND TRANSACTION MODELS Data Management in the Cloud SCALABLE CONSISTENCY AND TRANSACTION MODELS 69 Brewer s Conjecture Three properties that are desirable and expected from realworld shared-data systems C: data consistency A:

More information

Chapter 1: Introduction

Chapter 1: Introduction Chapter 1: Introduction Chapter 2: Intro. To the Relational Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Database Management System (DBMS) DBMS is Collection of

More information

II B.Sc(IT) [ BATCH] IV SEMESTER CORE: RELATIONAL DATABASE MANAGEMENT SYSTEM - 412A Multiple Choice Questions.

II B.Sc(IT) [ BATCH] IV SEMESTER CORE: RELATIONAL DATABASE MANAGEMENT SYSTEM - 412A Multiple Choice Questions. Dr.G.R.Damodaran College of Science (Autonomous, affiliated to the Bharathiar University, recognized by the UGC)Re-accredited at the 'A' Grade Level by the NAAC and ISO 9001:2008 Certified CRISL rated

More information

Chapter 1: Introduction

Chapter 1: Introduction Chapter 1: Introduction Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Outline The Need for Databases Data Models Relational Databases Database Design Storage Manager Query

More information

Final Exam Review 2. Kathleen Durant CS 3200 Northeastern University Lecture 23

Final Exam Review 2. Kathleen Durant CS 3200 Northeastern University Lecture 23 Final Exam Review 2 Kathleen Durant CS 3200 Northeastern University Lecture 23 QUERY EVALUATION PLAN Representation of a SQL Command SELECT {DISTINCT} FROM {WHERE

More information

Spatial Databases by Open Standards and Software 1.

Spatial Databases by Open Standards and Software 1. Spatial Databases by Open Standards and Software 1. The kinds of the database servers Gábor Nagy Spatial Databases by Open Standards and Software 1.: The kinds of the database servers Gábor Nagy Lector:

More information

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch. 1 :- Introduction Database Management System - 1

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch. 1 :- Introduction Database Management System - 1 Basic Concepts :- 1. What is Data? Data is a collection of facts from which conclusion may be drawn. In computer science, data is anything in a form suitable for use with a computer. Data is often distinguished

More information

Page 1. Goals for Today" What is a Database " Key Concept: Structured Data" CS162 Operating Systems and Systems Programming Lecture 13.

Page 1. Goals for Today What is a Database  Key Concept: Structured Data CS162 Operating Systems and Systems Programming Lecture 13. Goals for Today" CS162 Operating Systems and Systems Programming Lecture 13 Transactions" What is a database? Transactions Conflict serializability October 12, 2011 Anthony D. Joseph and Ion Stoica http://inst.eecs.berkeley.edu/~cs162

More information

14.1 Answer: 14.2 Answer: 14.3 Answer: 14.4 Answer:

14.1 Answer: 14.2 Answer: 14.3 Answer: 14.4 Answer: 14.1 Suppose that there is a database system that never fails. Is a recovery manager required for this system? Even in this case the recovery manager is needed to perform roll-back of aborted transactions.

More information

Class Overview. Two Classes of Database Applications. NoSQL Motivation. RDBMS Review: Client-Server. RDBMS Review: Serverless

Class Overview. Two Classes of Database Applications. NoSQL Motivation. RDBMS Review: Client-Server. RDBMS Review: Serverless Introduction to Database Systems CSE 414 Lecture 12: NoSQL 1 Class Overview Unit 1: Intro Unit 2: Relational Data Models and Query Languages Unit 3: Non-relational data NoSQL Json SQL++ Unit 4: RDMBS internals

More information

Chapter 24 NOSQL Databases and Big Data Storage Systems

Chapter 24 NOSQL Databases and Big Data Storage Systems Chapter 24 NOSQL Databases and Big Data Storage Systems - Large amounts of data such as social media, Web links, user profiles, marketing and sales, posts and tweets, road maps, spatial data, email - NOSQL

More information

Transactions. ACID Properties of Transactions. Atomicity - all or nothing property - Fully performed or not at all

Transactions. ACID Properties of Transactions. Atomicity - all or nothing property - Fully performed or not at all Transactions - An action, or series of actions, carried out by a single user or application program, which reads or updates the contents of the database - Logical unit of work on the database - Usually

More information

Database Management Systems CSEP 544. Lecture 9: Transactions and Recovery

Database Management Systems CSEP 544. Lecture 9: Transactions and Recovery Database Management Systems CSEP 544 Lecture 9: Transactions and Recovery CSEP 544 - Fall 2017 1 HW8 released Announcements OH tomorrow Always check the class schedule page for up to date info Last lecture

More information

CS425 Fall 2016 Boris Glavic Chapter 1: Introduction

CS425 Fall 2016 Boris Glavic Chapter 1: Introduction CS425 Fall 2016 Boris Glavic Chapter 1: Introduction Modified from: Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Textbook: Chapter 1 1.2 Database Management System (DBMS)

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lecture 21: Transaction Implementations CSE 344 - Winter 2017 1 Announcements WQ7 and HW7 are out Due next Mon and Wed Start early, there is little time! CSE 344

More information

DATABASE SYSTEMS. Database programming in a web environment. Database System Course,

DATABASE SYSTEMS. Database programming in a web environment. Database System Course, DATABASE SYSTEMS Database programming in a web environment Database System Course, 2016-2017 AGENDA FOR TODAY The final project Advanced Mysql Database programming Recap: DB servers in the web Web programming

More information

CSE 444: Database Internals. Lectures Transactions

CSE 444: Database Internals. Lectures Transactions CSE 444: Database Internals Lectures 13-14 Transactions CSE 444 - Spring 2014 1 Announcements Lab 2 is due TODAY Lab 3 will be released today, part 1 due next Monday HW4 is due on Wednesday HW3 will be

More information

Overview of Data Management

Overview of Data Management Overview of Data Management Grant Weddell Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Spring 2016 CS 348 (Intro to DB Mgmt) Overview of Data Management

More information

Page 1. CS194-3/CS16x Introduction to Systems. Lecture 8. Database concurrency control, Serializability, conflict serializability, 2PL and strict 2PL

Page 1. CS194-3/CS16x Introduction to Systems. Lecture 8. Database concurrency control, Serializability, conflict serializability, 2PL and strict 2PL CS194-3/CS16x Introduction to Systems Lecture 8 Database concurrency control, Serializability, conflict serializability, 2PL and strict 2PL September 24, 2007 Prof. Anthony D. Joseph http://www.cs.berkeley.edu/~adj/cs16x

More information

Announcements. Two Classes of Database Applications. Class Overview. NoSQL Motivation. RDBMS Review: Serverless

Announcements. Two Classes of Database Applications. Class Overview. NoSQL Motivation. RDBMS Review: Serverless Introduction to Database Systems CSE 414 Lecture 11: NoSQL 1 HW 3 due Friday Announcements Upload data with DataGrip editor see message board Azure timeout for question 5: Try DataGrip or SQLite HW 2 Grades

More information

Advances in Data Management - NoSQL, NewSQL and Big Data A.Poulovassilis

Advances in Data Management - NoSQL, NewSQL and Big Data A.Poulovassilis Advances in Data Management - NoSQL, NewSQL and Big Data A.Poulovassilis 1 NoSQL So-called NoSQL systems offer reduced functionalities compared to traditional Relational DBMSs, with the aim of achieving

More information

Chapter 9: Transactions

Chapter 9: Transactions Chapter 9: Transactions modified from: Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 9: Transactions Transaction Concept Transaction State Concurrent Executions

More information