Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 118 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
118
Dung lượng
3,24 MB
Nội dung
Ho Chi Minh City University of Technology Faculty of Computer Science and Engineering Chapter 2: Disk Storage and Basic File Structures Database Management Systems (CO3021) Computer Science Program Dr Võ Thị Ngọc Châu (chauvtn@hcmut.edu.vn) Semester – 2020-2021 Course outline Chapter Overall Introduction to Database Management Systems Chapter Disk Storage and Basic File Structures Chapter Indexing Structures for Files Chapter Query Processing and Optimization Chapter Introduction to Transaction Processing Concepts and Theory Chapter Concurrency Control Techniques Chapter Database Recovery Techniques References [1] R Elmasri, S R Navathe, Fundamentals of Database Systems- 6th Edition, Pearson- Addison Wesley, 2011 R Elmasri, S R Navathe, Fundamentals of Database Systems- 7th Edition, Pearson, 2016 [2] H G Molina, J D Ullman, J Widom, Database System Implementation, Prentice-Hall, 2000 [3] H G Molina, J D Ullman, J Widom, Database Systems: The Complete Book, Prentice-Hall, 2002 [4] A Silberschatz, H F Korth, S Sudarshan, Database System Concepts –3rd Edition, McGraw-Hill, 1999 [Internet] … Content 2.1 Disk Storage 2.2 File Operations 2.3 Unordered Files 2.4 Ordered Files 2.5 Hash Files 2.6 Other File Structures 2.7 Today’s Storage Technologies 2.8 Physical Storage in Today’s DBMSs 2.1 Disk Storage Databases A collection of data and their relationships Computerized Stored physically on computer storage media Primary storage Secondary storage Tertiary storage (Third-level storage) The DBMS software can then retrieve, update, and process the data as needed Computer Organization Hardware Computer Architecture ALU = Arithmetic/logic gate unit: performing arithmetic and logic operations on data 2.1 Disk Storage Memory hierarchy and storage devices The highest-speed memory is the most expensive and is therefore available with the least capacity The lowest-speed memory is offline tape storage, which is essentially available in indefinite (without clear limits) storage capacity Primary storage level Secondary and tertiary storage level - Register - Magnetic disk - Cache (static RAM) - Mass storage (CD-ROM, DVD) - DRAM (dynamic RAM) - Tape 2.1 Disk Storage Types of storage with capacity, access time, max bandwidth (transfer speed), and commodity cost Table 16.1, pp 545 [1] R Elmasri, S R Navathe, Fundamentals of Database Systems- 7th Edition, Pearson, 2016 2.1 Disk Storage Storage organization of databases Databases typically store large amounts of data that must persist over long periods of time Persistent data (not transient data which persists for only a limited time during program execution) Most databases are stored permanently (or persistently) on magnetic disk secondary storage Database size No permanent loss of stored data with nonvolatile storage Storage cost 2.1 Disk Storage Magnetic disks Disks are covered with magnetic material The most basic unit of data on the disk is a single bit of information By magnetizing an area on a disk in certain ways, one can make that area represent a bit value of either (zero) or (one) To code information, bits are grouped into bytes (or characters): byte = bits, normally The capacity of a disk is the number of bytes it can store Whatever their capacity, all disks are made of magnetic material shaped as a thin circular disk 10 2.7 RAID - Redundant Arrays of Inexpensive/Independent Disks Software RAID Hardware-assisted Software RAID Hardware RAID (controller: RAID-on-chip or add-in card) Source: adaptec®, Hardware RAID vs Software RAID: Which Implementation is Best for my Application? White paper, 2006 104 2.7 Today’s Storage Technologies Network-attached storage (NAS) NAS devices connect storage to a network where they are accessed through file shares NAS devices support multiple protocols: network attached file systems, Common Internet File Systems (CIFS), and Server Message Block (SMB) Source: MS SQL Server, Storage Technologies Overview, 2016 105 2.7 Today’s Storage Technologies Storage area network (SAN) A storage area network is a dedicated network that allows sharing storage A SAN does not provide file abstraction, only block-level operations A SAN uses serial attached SCSI, Fibre Channel, or iSCSI protocol over a Fibre Channel or Ethernet network A SAN can be managed by using Simple Network Management Protocol (SNMP) or a proprietary management protocol SNMP is based on TCP/IP, and it offers basic alert management This allows a node in SAN to alert the management system of failures Source: MS SQL Server, Storage Technologies Overview, 2016 106 2.7 Today’s Storage Technologies Source: MS SQL Server, Storage Technologies Overview, 2016 107 2.8 Physical Storage in Today’s DBMSs Oracle 19c Schema Object Storage Storage structure = segment: data segment, index segment Tablespace: a database storage unit that contains objects from different schemas One tablespace is associated with one or many physical data files One segment cannot span multiple tablespaces One data segment for one table spans two data files, which are both part of the same tablespace 108 2.8 Physical Storage in Today’s DBMSs Tablespace, Segments, Data Files in Oracle 19c 109 2.8 Physical Storage in Today’s DBMSs Tablespace Segment Extent Oracle Data Block Storage in Oracle 19c An extent is a set of logically contiguous data blocks allocated for storing a specific type of information 110 2.8 Physical Storage in Today’s DBMSs Oracle Database tables in Oracle 19c: Relational tables Relational tables have simple columns and are the most common table type A heap-organized table does not store rows in any particular order, created by default An index-organized table orders rows according to the primary key values by means of B-tree indexes An external table is a read-only table whose metadata is stored in the database but whose data is stored outside the database Object tables The columns correspond to the top-level attributes of an object type 111 2.8 Physical Storage in Today’s DBMSs An index-organized table in Oracle 19c 112 Summary Storage devices Magnetic disks for large amounts of data Disk pack cylinder track sector bit Bit byte block track cylinder Block: data transfer unit between disks and main memory Address: cylinder number + track number + block number Double buffering Data byte field record file => disk blocks Blocking factor Primary file organization for records of one type Unordered (heap) files Ordered (sequential) files Hashed files 113 Summary Static files vs Dynamic files File operations File organization vs Access method Each primary file organization Placing records in blocks and placing blocks on disks Goal: minimize the number of block transfers Further readings Parallelizing disk access using RAID technology Modern storage architectures: storage area networks (SAN), network-attached storage (NAS), 114 … Chapter 2: Disk Storage and Basic File Structures 115 Check for understandings 2.1 Describe the memory hierarchy for data storage 2.2 Distinguish between persistent data and transient data 2.3 Describe disk parameters when magnetic disks are used for storing large amounts of data 2.4 Describe double buffering What kind of time can be saved with this technique? 2.5 Describe the read/write commands with magnetic disks 116 Check for understandings 2.6 Distinguish between fixed-length records and variable-length records 2.7 Distinguish between spanned records and unspanned records 2.8 What is blocking factor? How to compute it? 2.9 What is file organization? What is its goal? 2.10 What is access method? How is it related to file organization? 117 Check for understandings 2.11 Distinguish between static files and dynamic files 2.12 Compare unordered files, ordered files, and hash files 2.13 Which operations are more efficient for each file organization: unordered, ordered, hash? Why? 2.14 Distinguish between static hashing and dynamic hashing 2.15 Compare three dynamic hashing techniques: Extendible Hashing, Dynamic Hashing, and Linear Hashing 118