《数据库系统原理Database System Concepts》双语课件-ch10(transaction)
合集下载
数据库系统概念PPT第一章,对应原版教材第五版
Instance – the actual content of the database at a particular point in time
Analogous to the value of a variable
Physical Data Independence – the ability to modify the physical schema
Security problems
Database systems offer solutions to all the above problems
Database System Concepts
1.5
©Silberschatz, Korth and Sudarshan, Bo Zhou
Data Abstraction
1.6
©Silberschatz, Korth and Sudarshan, Bo Zhou
Levels of Abstraction
A major purpose of database system is to provide an abstract of
view of data, and hide the certain detail of data storage.
Integrity constraints (e.g. account balance > 0) become part
of program code
Hard to add new constraints or change existing ones
Database System Concepts
without changing the logical schema
Analogous to the value of a variable
Physical Data Independence – the ability to modify the physical schema
Security problems
Database systems offer solutions to all the above problems
Database System Concepts
1.5
©Silberschatz, Korth and Sudarshan, Bo Zhou
Data Abstraction
1.6
©Silberschatz, Korth and Sudarshan, Bo Zhou
Levels of Abstraction
A major purpose of database system is to provide an abstract of
view of data, and hide the certain detail of data storage.
Integrity constraints (e.g. account balance > 0) become part
of program code
Hard to add new constraints or change existing ones
Database System Concepts
without changing the logical schema
数据库系统原理英文PPT课件
file system: file’s logical structures and access methods
I/O system : drivers
memory controllers (i.e. disk controller),
on the basis of secondary storage’s physical structures, such as storage structures, access method
February 2011
7
第7页/共70页
§1.2 Purpose of Database Systems (cont.)
• Data management on the basis of file systems
• Example
— customer_record=<c_name, c_id, street, city> in Customer_File
February 2011
1
第1页/共70页
§1.0 DB, DBMS, DBS
• Definitions in the textbook • Database (DB) — a collection of interrelated data, stored in systems as files • Database management system (DBMS) — DB, or a collection of interrelated data — set of programs to access the data in DB
• Databases and DBS touch all aspects of our lives • Banking: all transactions • Airlines: reservations, schedules • Universities: registration, grades • Sales: customers, products, purchases • Manufacturing: production, inventory, orders, supply chain • Human resources: employee records, salaries, tax deductions
I/O system : drivers
memory controllers (i.e. disk controller),
on the basis of secondary storage’s physical structures, such as storage structures, access method
February 2011
7
第7页/共70页
§1.2 Purpose of Database Systems (cont.)
• Data management on the basis of file systems
• Example
— customer_record=<c_name, c_id, street, city> in Customer_File
February 2011
1
第1页/共70页
§1.0 DB, DBMS, DBS
• Definitions in the textbook • Database (DB) — a collection of interrelated data, stored in systems as files • Database management system (DBMS) — DB, or a collection of interrelated data — set of programs to access the data in DB
• Databases and DBS touch all aspects of our lives • Banking: all transactions • Airlines: reservations, schedules • Universities: registration, grades • Sales: customers, products, purchases • Manufacturing: production, inventory, orders, supply chain • Human resources: employee records, salaries, tax deductions
数据库系统概念(database system concepts)英文第六版 PPT 第11章
11.8
©Silberschatz, Korth and Sudarshan
Sparse Index Files (Cont.)
Compared to dense indices:
Less space and less maintenance overhead for insertions and deletions. Generally slower than dense index for locating records.
Database System Concepts - 6th Edition
11.3
©Silberschatz, Korth and Sudarshan
Index Evaluation Metrics
Access types supported efficiently. E.g.,
records with a specified value in the attribute or records with an attribute value falling in a specified range of values.
actual records with that particular search-key value.
Secondary indices have to be dense
Database System Concepts - 6th Edition 11.10 ©Silberschatz, Korth and Sudarshan
value in the file.
E.g. index on ID attribute of instructor relation
数据库系统概念(database system concepts)英文第六版 PPT 第23章
Unlike relational tuples, XML data is self-documenting due to presence of tags Non-rigid format: tags can be added Allows nested structures Wide acceptance, not only in database systems, but also in browsers, tools, and applications
XML Motivation (Cont.)
Earlier generation formats were based on plain text with line headers
indicating the meaning of fields
Similar in concept to email headers Does not allow for nested structures, no standard “type” language Tied too closely to low level document structure (lines, spaces, etc) XML type specification languages to specify the syntax
Database System Concepts - 6th Edition
23.4
© Silberschatz, Korth and Sudarshan
XML: Motivation
Data interchange is critical in today’s networked world
23.2
数据库系统概念(database system concepts)英文第六版 第一章
n In the early days, database applications were built directly on top of file systems
Databa se Sy stem Concept s - 6th Edition
1 .3
©Silber schatz , Korth and S u dar
n Relational model (Chapter 2) n Example of tabular data in the relational model Columns
_____ Rows
Databa se Sy stem Concept s - 6th Edition
1 .10
©Silber schatz , Korth and S u dar
n Physical Data Independence – the ability to modify the physical schema without changing the logical schema l Applications depend on the logical schema l In general, the interfaces between the various levels and components should be well defined so that changes in some parts do not seriously influence others.
1 .5
©Silber schatz , Korth and S u dar
n Phys ical level : describes how a record (e.g., customer) is stored. n Logical level : describes data stored in database, and the relationships among the data. type instructor = record ID : string;
Databa se Sy stem Concept s - 6th Edition
1 .3
©Silber schatz , Korth and S u dar
n Relational model (Chapter 2) n Example of tabular data in the relational model Columns
_____ Rows
Databa se Sy stem Concept s - 6th Edition
1 .10
©Silber schatz , Korth and S u dar
n Physical Data Independence – the ability to modify the physical schema without changing the logical schema l Applications depend on the logical schema l In general, the interfaces between the various levels and components should be well defined so that changes in some parts do not seriously influence others.
1 .5
©Silber schatz , Korth and S u dar
n Phys ical level : describes how a record (e.g., customer) is stored. n Logical level : describes data stored in database, and the relationships among the data. type instructor = record ID : string;
数据库系统概念(database system concepts)英文第六版 PPT 第17章
Database System Concepts - 6th Edition
17.3
© Silberschatz, Korth and Sudarshan
A Centralized Computer System
Database System Concepts - 6th Edition
17.4
© Silberschatz, Korth and Sudarshan
computer systems.
General-purpose computer system: one to a few CPUs and a number
of device controllers that are connected through a common bus that provides access to shared memory.
Checkpoint process
Performs periodic checkpoints
Monitors other processes, and takes recovery actions if any of the other processes fail
Process monitor process
Chapter 17: Database System Architectures
Centralized and Client-Server Systems Server System Architectures Parallel Systems Distributed Systems
better functionality for the cost flexibility in locating resources and expanding facilities better user interfaces easier maintenance
数据库系统概念(databasesystemconcepts)英文第六版-第四章精品PPT课件
4.6
©Silberschatz, Korth and Sudarshan
Right Outer Join
n course natural right outer join prereq
Database System Concepts - 6th Edition
4.7
©Silberschatz, Korth and Sudarshan
Joined Relations
n Join operations take two relations and return as a result another relation.
n These additional operations are typically used as subquery expressions in the from clause
Database System Concepts - 6th Edition
4.5
©Silberschatz, Korth and Sudarshan
Left Outer Join
n course natural left outer join prereq
Database System Concepts - 6th Edition
n Join Expressions n Views n Transactions n Integrity Constraints n SQL Data Types and Schemas n Authorization
Database System Concepts - 6th Edition
4.2
n Join condition – defines which tuples in the two relations match, and what attributes are present in the result of the join.
Database system concepts PPT
particular enterprise
Collection of interrelated data
Set of programs to access the data
An environment that is both convenient and efficient to use Defining structures for storage of information
1.9
©Silberschatz, Korth and Sudarshan
Basic Concepts: DB, DBMS
Database(DB): a collection of data for one or more purpose.
Database Management System(DBMS): contains information about a
file systems.
Example: a bank needs to keep information about all customers and
saving accounts.
Drawbacks of using file systems to store data:
Data redundancy and inconsistency
1.5
©Silberschatz, Korth and Sudarshan
Course Introduction
Final result?
Laboratory: 30 p Theory: 70p
Exam in the middle of the school term: 10 p Exam in the end of the school term: 60 p
数据库系统概念(database system concepts)英文第六版 PPT 第15章
requesting and releasing locks. Locking protocols restrict the set of possible schedules.
Database System Concepts - 6th Edition
15.5
©Silberschatz, Korth and Sudarshan
The Two-Phase Locking Protocol (Cont.)
There can be conflict serializable schedules that cannot be obtained if
two-phase locking is used.
However, in the absence of extra information (e.g., ordering of access
to data), two-phase locking is needed for conflict serializability in the following sense: Given a transaction Ti that does not follow two-phase locking, we can find a transaction Tj that uses two-phase locking, and a schedule for Ti and Tj that is not conflict serializable.
©Silberschatz, Korth and Sudarshan
Lock-Based Protocols (Cont.)
Lock-compatibility matrix
数据库系统概念(database system concepts)英文第六版 PPT 第六章
Database System Concepts - 6th Edition
6.8
©Silberschatz, Korth and Sudarshan
Union Operation
Notation: r s Defined as:
r s = {t | t r or t s}
©Silberschatz, Korth and Sudarshan
Cartesian-Product Operation – Example
Relations r, s:
r x s:
Database System Concepts - 6th Edition
6.12
©Silberschatz, Korth and Sudarshan
Project Operation
Notation:
A , A , , A 1 2 k
(r )
where A1, A2 are attribute names and r is a relation name.
The result is defined as the relation of k columns obtained by erasing
For r s to be valid.
1. r, s must have the same arity (same number of attributes) 2. The attribute domains must be compatible (example: 2nd column of r deals with the same type of values as does the 2nd column of s)
《数据库系统原理Database System Concepts》双语课件-ch12(Recovery)
2
Database Access
When to execute the output operation is determined by buffer replacement strategy, or forced flushing as a transaction commit, or doing a checkpoint operation.
Database System Concepts
5
Failure Classification
• System crash: a power failure or other hardware or software failure causes the system to crash – No physical damage. – The contents of memory will be lost. – Transactions that is not completed must be undone at restart time. – Also have to redo transactions that had been finished but not flushed-to-disk.
– Tapes for archive database keeping the data copies in stable database.
Database Buffer Stable Database Archive Database
Memory Disk Tape
Database System Concepts
Recovery all things is not realistic - try its best to recover!
数据库系统原理(英文)811PPT课件
DB physical schema, e.g. physical storage structure and access method (chapter 11, 12)
April 2011
Fig. 6.0.1 DB design phases
Database System Concepts - Chapter8 Application Design and Development - 5
▪ As an integrity control mechanism, Trigger is introduced to SQL1999 standard, but supported even earlier using nonstandard syntax by most databases
April 2011
Application areas/problems in real worlds
Requirements analysis
Specification of user requirements (需求分析说明书)
Conceptual DB design
DB conceptual schema , i.e. E-R diagram (chapter 6)
April 2011
Database System Concepts - Chapter8 Application Design and Development - 9
宿主语言 + DML
用户A2
宿主语言 + DML
用户B1
宿主语言 + DML
用户B2
宿主语言 + DML
外模式 外部视图A
外部视图B
数据库系统原理(英文)-0--courseintroduction-16讲义.
Body of Knowledge in Computer Science
包括如下14个知识领域: CS-AR计算机体系结构与组织 CS-AL算法与复杂性 CS-HC人机交互 CS-OS 操作系统 CS-PF程序设计基础 CS-SP社会与职业问题 CS-SE软件工程 CS-DS离散结构 CS-NC以网络为中心的计算 CS-PL程序设计语言
Body of Knowledge in Computer Science(cont.) —— Knowledge Topics in CS-IM信息管理
IM2数据库系统(核心) 知识点: 数据库系统简介 数据库系统的组件 DBMS功能 数据库的体系结构和数据完整性 数据库查询语言概述
Body of Knowledge in Computer Science(cont.) —— Knowledge Topics in CS-IM信息管理
Body of Knowledge in Computer Engineering
包括如下18个知识领域: CE-ALG 算法与复杂度 CE-CAO 计算机体系结构和组织 CE-CSE 计算机系统工程 CE-CSG 电路和信号 CE-DBS 数据库系统 CE-DIG 数字逻辑 CE-DSP 数字信号处理 CE-ELE 电子学 CE-ESY 嵌入式系统 CE-HCI 人机交互
AreContents of Class Teaching Basic Experiments on SQL Server, DB2 and Sybase Course Design Some Issues to Be Emphasized
Teaching contents principles and implementation/development techniques of DBS taking SQL Server as case studies in in-class teaching, after-class experiments, and course design
《数据库系统原理Database System Concepts》双语课件-ch7(Index)
Database System Concepts
Fall 2009
7
Ordered Indices
• Secondary index: an index whose search key specifies an order different from the sequential order of the file. Also called non-clustering index.
Chapter 12: Indexing and Hashing
• Basic Concepts • Ordered Indices • B+-Tree Index Files • B-Tree Index Files • Static Hashing • Comparison of Ordered Indexing and Hashing • Bitmap Index
• Access time • Insertion time • Deletion time • Space overhead
Database System Concepts
Fall 2009
6
Ordered Indices
• In an ordered index, index entries are stored sorted on the search key value. E.g., author catalog in library.
• Two basic kinds of indices: – Ordered indices: search keys are stored in a sorted order – Hash indices: search keys are distributed uniformly across “buckets” using a “hash function”.
数据库系统原理(英文)-2-10(1)
5
§2.1 Structure of Relational Databases
A relational database consists of a collection of relational tables a row in a table represents a relationship among a set of values a table is such a collection of relationships. 2.1.1 Basic structure Given sets D1, D2, …. Dn , a relation r is a subset of D1 ╳ D2 ╳ … ╳ Dn r = {(a1, a2, …, an )} ⊆ D1 ╳ D2 …..╳ Dn relation r = { tuple } /*元组 元组
March 2010
Database System Concepts - Chapter2 Relational Model -
9
2.1.2 Database schema
For attributes A1, A2, …, An , R = (A1, A2, …, An ) is a relation schema e.g. in Fig. 2.4, Customer-schema = (customer-name, customer-street, customer-city) orders of attributes is irrelevant r(R) is a relation on the relation schema R e.g. customer (customer-name, customer-street, customercity) on Customer-schema Relation instance the current values of a relation r at a particular time specified by a table
数据库系统概念(database system concepts)英文第六版 PPT 第五章
"select * from instructor where name = ‟" + name + "‟" Suppose the user, instead of entering a name, enters: X‟ or ‟Y‟ = ‟Y then the resulting statement becomes: "select * from instructor where name = ‟" + "X‟ or ‟Y‟ = ‟Y" + "‟" which is: select * from instructor where name = ‟X‟ or ‟Y‟ = ‟Y‟ User could have even used X‟; update instructor set salary = salary + 10000; - Prepared statement internally uses: "select * from instructor where name = ‟X\‟ or \‟Y\‟ = \‟Y‟ Always use prepared statements, with user inputs as parameters
How is this useful?
Database System Concepts - 6th Edition
5.10
©Silberschatz, Korth and Sudarshan
Metadata (Cont)
Database metadata DatabaseMetaData dbmd = conn.getMetaData();
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Transacfrom account A to account B in account (account_number, balance) .
Update account Set balance = balance - 50 Where account_number = ‘A’
process private area
xi=X
read write
buffer block
buffer
B
input output
disk
B
physical block
Simple Model of Database (cont.)
read_item(X) command includes the following steps: Find the address of the disk block that contains item X. Copy that disk block into a buffer in main memory (if that disk block is not already in some main memory buffer).- Input (X) Copy item X from the buffer to the program variable named xi.
The basic unit of data movement between the disk and main memory is a block.
Database Buffer Memory Stable Database Disk
Simple Model of Database (cont.)
Data access: two basic operations
read_item(X): Reads a database item X into a program variable xi.
write_item(X): Writes the value of program variable xi into the database item X.
Simple Model of Database (cont.)
write_item(X) command includes the following steps:
Find the address of the disk block that contains item X. Copy that disk block into a buffer in main memory (if
that disk block is not already in some main memory buffer). Copy item X from the program variable named xi into its correct location in the buffer. Store the updated block from the buffer back to disk (either immediately or at some later point in time) Output (X).
Chapter Outline
Simple Model of Database Transaction Concept Transaction State Concurrent Executions Serializability Recoverability
Review of Database System Architecture
Database Users Interface & Tools
Query processor Storage & Transaction
Processor
Data Storage
Simple Model of Database
Data storage: database permanently resides on disk, but some portion of it is temporarily residing in main memory. Main memory for database buffer caching currently used data. Disk for stable database storing main database.
Transaction boundary
T1: begin read(A); A:= A–50; write (A); read (B); B := B+50; write(B); commit;
Transaction Concepts
A transaction is a logical unit of work that includes one or more database access operations (read -retrieval, write - insert or update, delete). a sequence of operations including database operations that is atomic with respect to concurrency and recovery. atomic execution unit that, when applied to a consistent database, generates a consistent but possibly different database. a sequence of operations with the database which represents one meaningful activity in the user's environment.
Solution: Define this two operations within a transaction.
Transaction Example (cont.)
Define a funds-transfer transaction using read/ Write operations.
Update account Set balance = balance + 50 Where account_number = ‘B’
Requirement: Either all two operations are completed or none are.
What is your solution?