Danh mục

Bài giảng Hệ quản trị cơ sở dữ liệu - Chương 10: Indexing

Số trang: 43      Loại file: pptx      Dung lượng: 319.91 KB      Lượt xem: 18      Lượt tải: 0    
tailieu_vip

Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Index là phương tiện rất mạnh để tăng hiệu năng thực hiện của câu lệnh. Bài giảng chương 10 này sẽ cung cấp một số kiến thức liên quan đến Indexing để người học có thể nắm bắt được những tiện ích của công cụ index trong CSDL. Mời các bạn cùng tham khảo.
Nội dung trích xuất từ tài liệu:
Bài giảng Hệ quản trị cơ sở dữ liệu - Chương 10: IndexingChương10:Indexing 1 2 Why Concerning Storage and Indexing?• DB design using logical models (ER/Relational). – Appropriate level for designers to begin with – Provide independence from implementation details• Performance: another major factor in user satisfaction – Depends on • Efficient data structures for data representation • Efficiency of system operation on those structures – Disks contains data files and system files 3 Subjects to be Discussed• Disks: Can retrieve random page, but reading several consecutive pages is much cheaper than reading them in random order• Buffer manager: Stages pages from external storage to main memory buffer pool. File and index layers make calls to the buffer manager.• File organization: Method of arranging a file of records on external storage. – Record id (rid) is sufficient to physically locate record – Indexes are data structures that allow us to find the record ids of records with given values in index 4 Storage Hierarchy• DBMS stores information on some storage medium – Primary storage: can be operated directly by CPU. – Secondary storage: • larger capacity, lower cost, slower access • cannot be operated directly by CPU – must be copied to primary storage• Secondary storage has major implications for DBMS design – READ: transfer data to main memory – WRITE: transfer data from main memory. – Both transfers are high-cost operations, relative to 5 Why Not Store Everything in Main Memory?• Cost and size• Main memory is volatile: What’s the problem?• Typical storage hierarchy: – Factors: access speed, cost per unit, reliability – Cache and main memory (RAM) for currently used data: fast but costly – Flash memory: limited number of writes (and slow), non-volatile, disk-substitute in embedded systems – Disk for the main database (secondary storage). – Tapes for archiving older versions of the data (tertiary 6 Disks• Secondary storage device of choice.• Data is stored and retrieved in units called disk blocks or pages.• Unlike RAM, time to retrieve a disk page varies depending upon location on disk. – Therefore, relative placement of pages on disk has major impact on DBMS performance! 7 Components of a Disk• The platters spin• The arm assembly is moved in or out to position a head on a desired track. Tracks under heads make a cylinder (imaginary!).• Only one head reads/writes at any one time.• Block size is a multiple of sector size (which is fixed). 8 Accessing a Disk Page• Time to access (read/write) a disk block: – Seek time (moving arms to position disk head on track) – Rotational delay (waiting for block to rotate under head) – Transfer time (actually moving data to/from disk surface)• Seek time and rotational delay dominate. – Seek time varies from about 1 to 20msec – Rotational delay varies from 0 to 10msec 9 Arranging Pages on Disk• `Next’ block concept: – blocks on same track, followed by – blocks on same cylinder, followed by – blocks on adjacent cylinder• Blocks in a file should be arranged sequentially on disk (by `next’), to minimize seek and rotational delay.• For a sequential scan, pre-fetching several pages at a time is a big win! 10Arranging Pages on Disk 11 RAID• Redundant Arrays of Independent Disks (RAID)• Disk Array: Arrangement of several disks that gives abstraction of a single, large disk.• Goals: Increase performance and reliability.• Two main techniques: parallelism and redundancy – Data striping: Data is partitioned; size of a 12 Disk Space Management• Lowest layer of DBMS software manages space on disk.• Higher levels call upon this layer to: – allocate/de-allocate a page – read/w ...

Tài liệu được xem nhiều: