๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ“š ์ „๊ณต ๊ณต๋ถ€

(55)
[DB] ๋™์‹œ์„ฑ ์ œ์–ด Concurrency Control Techniques Concurrency Control Protocols : guarantee serializability (์ง๋ ฌํ™” ๋ณด์žฅ) Locking Timestamps multiversion CC protocols Optimistic protocols Multiple granularity concurrency control protocol Two-phase Locking Techniques : ์ด์ค‘ ๋ผํ‚น lock ์ƒํƒœ 1, unlock ์ƒํƒœ๋Š” 0 Lock table : lock ์ •๋ณด๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ์„œ๋ธŒ์‹œ์Šคํ…œ plus a queue for transactions that are waiting to access item Shared/Exclusive (or Read/Wr..
[DB] Transaction processing Transaction Concepts Concurrent Executions Transaction Schedule Serializability Recoverability Single-User vs Multiuser Systems ๊ต๋Œ€ ์ˆ˜ํ–‰ : interleaved concurrency Transaction : an executing program that forms a logical unit of db processing Begin transaction - end transaction; includes DB access operations read-only / read-write transaction read-item(X) : ๋””์Šคํฌ๋ธ”๋ก ์ฃผ์†Œ์ฐพ๊ธฐ-๋ฒ„ํผ์— ๋ณต์‚ฌ-ํ”„๋กœ๊ทธ๋žจ ๋ณ€์ˆ˜๋กœ ๋ณต์‚ฌ write-item(X)..
[DB] Indexing structures for files / ๋ฌผ๋ฆฌ์  DB์„ค๊ณ„ Index structures for files index : ์ถ”๊ฐ€์ ์ธ ๋ณด์กฐ์ ‘๊ทผ๊ตฌ์กฐ, ๊ฒ€์ƒ‰์†๋„ ์ฆ๊ฐ€, ๋Œ€์ฒด๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•จ, ํšจ์œจ์  ๊ฒ€์ƒ‰ Single-level ordered indexes primary, secondary, clustering ISAM : Indexed Sequential Access Method Multilevel indexes B trees, B+ trees Types of Single-level ordered indexes Primary index : ํ‚ค ํ•„๋“œ ์ •๋ ฌ ํŒŒ์ผ์—์„œ ์ •๋ ฌ ํ‚ค ํ•„๋“œ์— ๋Œ€ํ•ด ์ •์˜๋œ ์ธ๋ฑ์Šค Clustering index : ํ‚ค๊ฐ€ ์•„๋‹Œ๊ฑธ๋กœ ์ •๋ ฌ๋œ ํŒŒ์ผ์—์„œ ์ •๋ ฌ ํ•„๋“œ์— ๋Œ€ํ•ด ์ •์˜๋œ ์ธ๋ฑ์Šค Secondary index : any nonordering field Prima..
[DB] Disk, ํŒŒ์ผ๊ตฌ์กฐ, Hashing, ์ €์žฅ์†Œ ์„ค๊ณ„ DBs are stored physicaly as files of records stored on magnetic disks. storage hierarchy primary storage : ์ฃผ๊ธฐ์–ต์žฅ์น˜ operated on directly by the CPU Secondary storage : ๋ณด์กฐ๊ธฐ์–ต์žฅ์น˜, ์˜จ๋ผ์ธ Tertiary storage : ์˜คํ”„๋ผ์ธ ์•„์นด์ด๋ธŒ (์˜จ๋ผ์ธ์œผ๋กœ ๋กœ๋“œ ํ•„์š”) Memory Hierarchies and storage devices ์ƒ์œ„ ์ €์žฅ์†Œ : ๋น ๋ฆ„, ์ž‘์Œ, ๋น„์Œˆ ํ•˜์œ„ ์ €์žฅ์†Œ : ๋Š๋ฆผ, ํผ, ์Œˆ Storage of DBs ๋ฌผ๋ฆฌ์  DB ์„ค๊ณ„ files of records : locate them efficiently Primary FIle organizations heap f..
[DB] SQL programmingโŒจ๏ธ (2) Java Database Conectivity JDBC : sql connection function calls for java programming can access any DBMS that has a JDBC driver allows connect to data sources steps in JDBC ๋งค๊ฐœ๋ณ€์ˆ˜ ์ •์˜ (by “?”) ํ”„๋กœ๊ทธ๋žจ ๋ณ€์ˆ˜์™€ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๋ฐ”์šด๋“œ executeQuery๋กœ SQL ์‹คํ–‰ ๊ฒฐ๊ณผ๋ฅผ ResultSet์— ๋ฐ˜ํ™˜ db stored procedures ์ง€์†์ ์ธ ๋ชจ๋“ˆ์€ DB์„œ๋ฒ„ ๋กœ์ปฌ์— ์ €์žฅ๋จ ์žฅ์  : ์—ฌ๋Ÿฌ ์‘์šฉํ”„๋กœ๊ทธ๋žจ์— ์‚ฌ์šฉ, ์†Œํ†ต ๋น„์šฉ ๊ฐ์†Œ, ์œตํ†ต์„ฑ SQL persistent stored modules : ์˜๊ตฌ์ €์žฅ ๋ชจ๋“ˆ SQL/PSM SQL + stored functions + a..
[DB] SQL ProgrammingโŒจ๏ธ (1) Database Programming ๋ชฉํ‘œ : ๋Œ€ํ™”ํ˜• ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ ์•„๋‹Œ ์‘์šฉํ”„๋กœ๊ทธ๋žจ์—์„œ DB์— ์ ‘๊ทผ ์™œ? : ํŽธ๋ฆฌํ•˜์ง€๋งŒ ๋ถˆ์ถฉ๋ถ„ํ•˜๊ณ , ๋Œ€๋ถ€๋ถ„์ด ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์—์„œ ๋งŒ๋“ค์–ด์ง DB programming Approaches (์ ‘๊ทผ๋ฐฉ๋ฒ•) ์ž„๋ฒ ๋””๋“œ ํ•จ์ˆ˜ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ (API) ์ƒˆ ์–ธ์–ด : DBPL (Database Programming Language) → ๋ถˆ์ผ์น˜๋ฅผ ์ตœ์†Œํ™”ํ•  ์ˆ˜ ์žˆ์Œ Impedance Mismatch : ์ž„ํ”ผ๋˜์Šค ๋ถˆ์ผ์น˜ ํ˜ธ์ŠคํŠธ ์–ธ์–ด์™€ DB๋ชจ๋ธ ์‚ฌ์ด์˜ ๋น„ํ˜ธํ™˜์„ฑ Typical sequence of interaction in DB Programming ํด๋ผ์ด์–ธํŠธ ํ”„๋กœ๊ทธ๋žจ์ด DB์„œ๋ฒ„์™€์˜ ์—ฐ๊ฒฐ์„ open ํด๋ผ์ด์–ธํŠธ ํ”„๋กœ๊ทธ๋žจ์ด ์งˆ์˜์–ด๋ฅผ ๋ณด๋ƒ„ DB์ ‘๊ทผ์ด ํ•„์š”์—†์–ด์ง€๋ฉด ์ ‘์† ์ข…๋ฃŒ Embedded SQL COBOL, C..
[DB] SQL ๋ฌด๊ฒฐ์„ฑ ์ œ์•ฝ์กฐ๊ฑด ์œ„๋ฐฐ ์˜ˆ์ œ company DB ์—ฐ์Šต๋ฌธ์ œ๋“ค. ์ด ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๊ฐ€ ๊ต์œก์šฉ ์ž๋ฃŒ๋กœ ํ”ํ•˜๊ฒŒ ์“ฐ์ด๋Š” ๋“ฏ ํ•˜๋‹ค ๐Ÿ’ก [ ๊ฐœ์ฒด ๋ฌด๊ฒฐ์„ฑ : ํ‚ค๊ฐ’์ด null์ด๋ฉด ์•ˆ๋จ ] [ ์ฐธ์กฐ ๋ฌด๊ฒฐ์„ฑ : FK๊ฐ€ PK์— ์—†๋Š” ๊ฐ’์ด๋ฉด ์•ˆ๋จ ] ๋‹ค์Œ ๋ช…๋ น์ด ์–ด๋–ค ๋ฌด๊ฒฐ์„ฑ์„ ์œ„๋ฐ˜ํ•˜๋Š”์ง€ ์„ค๋ช…ํ•˜์‹œ์˜ค. 1) Insert into PROJECT. → DNUM=2์ด๊ณ  DNUMBER=2์™€ DEPACTION ๊ด€๊ณ„์— ํŠœํ”Œ์ด ์—†์œผ๋ฏ€๋กœ ์ฐธ์กฐ ๋ฌด๊ฒฐ์„ฑ์„ ์œ„๋ฐ˜. (์ฐธ์กฐํ•  ์ˆ˜ ์—†๋Š” FK๊ฐ’ 2๋ฅผ ๊ฐ€์ง€๊ฒŒ ๋˜๋ฏ€๋กœ) ์ œํ•œ ๋ฐฉ๋ฒ• (i) ์ƒˆ ํ”„๋กœ์ ํŠธ ํŠœํ”Œ ์‚ฝ์ž… ๊ฑฐ๋ถ€ (ii) ๋ถ€์„œ ๊ด€๊ณ„์—์„œ ์‹ ๊ทœ ํ”„๋กœ์ ํŠธ ํŠœํ”Œ์˜ DNUM ๊ฐ’์„ ๊ธฐ์กด DNUMBER ๊ฐ’์œผ๋กœ ๋ณ€๊ฒฝ (iii) DNUMBER=2์˜ ์ƒˆ ๋ถ€์„œ ํŠœํ”Œ์„ ์‚ฝ์ž…ํ•ฉ๋‹ˆ๋‹ค. 2) Insert into WORKS_ON. → ๊ฐœ์ฒด ๋ฌด๊ฒฐ์„ฑ ๋ฐ ์ฐธ์กฐ ๋ฌด๊ฒฐ์„ฑ์„ ..
[DB] Schema, DDL, DML ์ •๋ฆฌ The goal of Three-schema architecture is to separate the user applications and the physical DB. → ๋ชฉํ‘œ = ์‚ฌ์šฉ์ž ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜๊ณผ ๋ฌผ๋ฆฌ์  DB๋ฅผ ๋ถ„๋ฆฌํ•˜์—ฌ DB์˜ ๋…๋ฆฝ์„ฑ ํ™•๋ณด. Internal schema describes the physical storage structure of the DB. Conceptual schema describes the structure of the whole DB for a community of users. External schema describes the part of the DB that a particular user group is interested in and hides the r..