Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to Database Systems
Search
Lipyeow
August 15, 2015
Technology
0
1.3k
Introduction to Database Systems
Introduction to Database Systems
Lipyeow
August 15, 2015
Tweet
Share
More Decks by Lipyeow
See All by Lipyeow
Computer Networks Primer
lipyeow
0
540
Semi-structured Data Models & XML
lipyeow
0
310
Query Processing in DBMS
lipyeow
0
700
Storage & Indexing 1
lipyeow
0
1.2k
Storage & Indexing 2
lipyeow
0
650
Transaction Processing 1
lipyeow
0
780
Transaction Processing 2
lipyeow
0
550
Constraints, Triggers, Views, & Indexes
lipyeow
0
780
Functional Dependencies
lipyeow
0
1.2k
Other Decks in Technology
See All in Technology
EMとして2023年度に頑張ったこと / What we did well in FY2023 as a EM
pauli
1
200
Gradle Build Scanを使ってビルドのことを知ろう potatotips #87
tomorrowkey
2
150
ルーターでプレゼンする
puhitaku
1
3.2k
Azureの基本的な権限管理の勉強会
yhana
1
2k
データベース02: データベースの概念
trycycle
0
180
R3のコードから見る実践LINQ実装最適化・コンカレントプログラミング実例
neuecc
3
2k
今年のRubyKaigiはProfiler Year🤘
osyoyu
0
310
チームでロジカルシンキングに改めて向き合っている話 〜学習環境と実践⽅法〜
sansantech
PRO
3
3.2k
アクセス制御にまつわる改善 / Improving access control
itkq
0
590
LLM開発・活用の舞台裏@2024.04.25
yushin_n
3
1.1k
開発パフォーマンスを最大化するための開発体制
ham0215
7
1k
LayerXにおけるLLMプロダクト開発の今までとこれから
layerx
PRO
3
590
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
242
1.2M
Music & Morning Musume
bryan
41
5.6k
What the flash - Photography Introduction
edds
64
11k
Building Adaptive Systems
keathley
32
1.9k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
275
13k
Designing with Data
zakiwarfel
96
4.8k
A better future with KSS
kneath
231
16k
A Philosophy of Restraint
colly
197
16k
Optimising Largest Contentful Paint
csswizardry
12
2.4k
Building Applications with DynamoDB
mza
88
5.6k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
79
43k
Transcript
ICS$321$Data$Storage$&$Retrieval$$ Introduc8on$to$Database$Systems$ Prof.$$Lipyeow$Lim$ Informa8on$&$Computer$Science$Department$ University$of$Hawaii$at$Manoa$ 1$ Lipyeow$Lim$FF$University$of$Hawaii$at$Manoa$
Data,$Database,$DBMS$ ! A$database$:$a$collec8on$of$related$data.$ ! Represents$some$aspect$of$the$real$world$(aka$ universe$of$discourse).$ ! Logically$coherent$collec8on$of$data$ ! Designed$and$built$for$specific$purpose$$
! Data$are$known$facts$that$can$be$recorded$and$ that$have$implicit$meaning.$ ! A$data(model!is$a$collec8on$of$concepts$for$ describing$data.$ ! A$schema!is$a$descrip8on$of$a$par8cular$ collec8on$of$data,$using$the$a$given$data$model.$ Lipyeow$Lim$FF$University$of$Hawaii$at$Manoa$ 2$
DBMS$ • A$database(management(system((DBMS)$is$a$ collec&on!of!programs!that$enables$users$to$ – Create$new$DBs$and$specify$the$structure$using$ data$defini8on$language$(DDL)$ – Query$data$using$a$query$language$or$data$ manipula8on$language$(DML)$ – Store$very$large$amounts$of$data$ – Support$durability$in$the$face$of$failures,$errors,$
misuse$ – Control$concurrent$access$to$data$from$many$ users$ Lipyeow$Lim$FF$University$of$Hawaii$at$Manoa$ 3$
Types$of$Databases$ ! OnFline$Transac8on$ Processing$(OLTP)$ ! Banking$ ! Airline$reserva8ons$ ! Corporate$records$
! OnFline$Analy8cal$ Processing$(OLAP)$ ! Data$warehouses,$data$ marts$ ! Business$intelligence$(BI)$ ! Specialized$databases$ ! Mul8media$ ! XML$ ! Geographical$Informa8on$ Systems$(GIS)$ ! RealF8me$databases$ (telecom$industry)$ ! Special$Applica8ons$ ! Customer$Rela8onship$ Management$(CRM)$ ! Enterprise$Resource$ Planning$(ERP)$ ! Hosted$DB$Services$ ! Amazon,$Salesforce$ Lipyeow$Lim$FF$University$of$Hawaii$at$Manoa$ 4$
A$Bit$of$History$ ! 1970$Edgar$F$Codd$$(aka$“Ted”)$invented$the$rela8onal$ model$in$the$seminal$paper$“A$Rela8onal$Model$of$ Data$for$Large$Shared$Data$Banks”$ " Main$concept:$$rela&on$=$a$table$with$rows$and$columns.$ " Every$rela8on$has$a$schema,$which$describes$the$columns.$ !
Prior$1970,$no$standard$data$model.$$ ! Network$model$used$by$Codasyl$ ! Hierarchical$model$used$by$IMS$ ! Aaer$1970,$IBM$built$System$R$as$proofFofFconcept$for$ rela8onal$model$and$used$SQL$as$the$query$language.$ SQL$eventually$became$a$standard.$$$$ Lipyeow$Lim$FF$University$of$Hawaii$at$Manoa$ 5$
DBMS$ • A$database(management(system((DBMS)$is$a$ collec&on!of!programs!that$enables$users$to$ – Create$new$DBs$and$specify$the$structure$using$ data$defini8on$language$(DDL)$ – Query$data$using$a$query$language$or$data$ manipula8on$language$(DML)$ – Store$very$large$amounts$of$data$ – Support$durability$in$the$face$of$failures,$errors,$
misuse$ – Control$concurrent$access$to$data$from$many$ users$ Lipyeow$Lim$FF$University$of$Hawaii$at$Manoa$ 6$
DBMS$Components$ Lipyeow$Lim$FF$University$of$Hawaii$at$Manoa$ 7$ Storage$ Storage$Manager$ Buffer$Manager$ Index/file/record$ Manager$ Execu8on$Engine$ Query$Compiler$
Transac8on$Manager$ Logging$&$Recovery$ DDL$compiler$ Concurrency$ Control$ Lock$Table$ Buffers$ User/Application Database Administrator
Transac8on:$An$Execu8on$of$a$DB$Program$ ! A$transac&on$is$an$atomic$sequence$of$database$ ac8ons$(reads/writes).$ ! Each$transac8on,$executed$completely,$must$leave$the$ DB$in$a$consistent$state$if$DB$is$consistent$when$the$ transac8on$begins.$ ! A$DBMS$executes$mul8ple$transac8ons$concurrently$
! Instead$of$serially$one$aaer$another$ ! Results$in$beger$DBMS$performance.$Why$?$ ! Interleaving$ac8ons$of$different$transac8ons$can$lead$to$ inconsistency$e.g.,$check$is$cleared$while$account$balance$ is$being$computed.$ ! DBMS$ensures$such$problems$don’t$arise:$$users$can$ pretend$they$are$using$a$singleFuser$system.$ Lipyeow$Lim$FF$University$of$Hawaii$at$Manoa$ 8$
ACID$Proper8es$ • Atomicity$:$allForFnothing$execu8on$of$ transac8ons$ • Consistency:$$constraints$on$data$elements$is$ preserved$ • Isola8on:$each$transac8on$executes$as$if$no$ other$transac8on$is$execu8ng$concurrently$
• Durability:$effect$of$an$executed$transac8on$ must$never$be$lost$ Lipyeow$Lim$FF$University$of$Hawaii$at$Manoa$ 9$
Ensuring$Isola8on$ ! Scheduling$concurrent$transac8ons$ ! DBMS$ensures$that$execu8on$of${T1,$...$,$Tn}$is$ equivalent$to$some$serial$execu8on$T1’$...$Tn’.$ " Idea:$use$locks$to$serialize$access$to$shared$ objects$ "
Strict$2$Phase$locking$protocol:$ " Before$reading/wri8ng$an$object,$a$transac8on$ requests$a$lock$on$the$object,$and$waits$8ll$the$DBMS$ gives$it$the$lock.$$$ " All$locks$are$released$at$the$end$of$the$transac8on.$$$ " What$if$Tj$already$has$a$lock$on$Y$and$Ti$later$requests$ a$lock$on$Y?$(Deadlock!)$Ti$or$Tj$is$aborted$and$ restarted!$$ Lipyeow$Lim$FF$University$of$Hawaii$at$Manoa$ 10$
Ensuring$Atomicity$ ! DBMS$ensures$atomicity!even$if$system$crashes$ in$the$middle$of$a$Xact.$ ! Idea:$Keep$a$log$(history)$of$all$ac8ons$carried$ out$by$the$DBMS$while$execu8ng$a$set$of$Xacts.$ " Write$Ahead$Log$(WAL)$protocol$ "
Before$a$change$is$made$to$the$database,$the$ corresponding$log$entry$is$forced$to$disk.$$ " Aaer$a$crash,$the$effects$of$par8ally$executed$ transac8ons$are$undone$using$the$log.$$ " WAL$property:$if$log$entry$wasn’t$saved$before$the$ crash,$corresponding$change$was$not$applied$to$ database!$ Lipyeow$Lim$FF$University$of$Hawaii$at$Manoa$ 11$
Summary$ • Defini8ons$of$data,$databases,$data$models,$ schema$ • When$to$use$or$not$use$a$DBMS$ • DBMS$major$components$ • Transac8ons$and$concurrency$
• ACID$proper8es$of$transac8ons$ • Techniques$for$ensuring$ACID$proper8es$in$ DBMSs.$ Lipyeow$Lim$FF$University$of$Hawaii$at$Manoa$ 12$