World Library  
Flag as Inappropriate
Email this Article

Database storage structures

Article Id: WHEBN0010983365
Reproduction Date:

Title: Database storage structures  
Author: World Heritage Encyclopedia
Language: English
Subject: Database, Master data management, Relational database management systems, ISO/IEC JTC 1/SC 23, Transactions per second
Collection: Database Management Systems, Database Theory, Databases
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Database storage structures

Database tables and indexes may be stored on disk in one of a number of forms, including ordered/unordered flat files, ISAM, heap files, hash buckets, or B+ trees. Each form has its own particular advantages and disadvantages. The most commonly used forms are B+ trees and ISAM. Such forms or structures are one aspect of the overall schema used by a database engine to store information.

Contents

  • Unordered 1
  • Ordered 2
  • Structured files 3
    • Heap files 3.1
    • Hash buckets 3.2
    • B+ trees 3.3
    • ISAM 3.4
  • Data orientation 4

Unordered

Unordered storage typically stores the records in the order they are inserted. Such storage offers good insertion efficiency (O\left(1\right)), but inefficient retrieval times (O\left(n\right)). Typically these retrieval times are better, however, as most databases use indexes on the primary keys, resulting in retrieval times of O\left(\log n\right) or O\left(1\right) for keys that are the same as the database row offsets within the storage system.

Ordered

Ordered storage typically stores the records in order and may have to rearrange or increase the file size when a new record is inserted, resulting in lower insertion efficiency. However, ordered storage provides more efficient retrieval as the records are pre-sorted, resulting in a complexity of O\left(\log n\right).

Structured files

Heap files

  • Simplest and most basic method
    • insert efficient, with new records added at the end of the file, providing chronological order
    • retrieval inefficient as searching has to be linear
    • deletion is accomplished by marking selected records as "deleted"
    • requires periodic reorganization if file is very volatile (changed frequently)
  • Advantages
    • efficient for bulk loading data
    • efficient for relatively small relations as indexing overheads are avoided
    • efficient when retrievals involve large proportion of stored records
  • Disadvantages
    • not efficient for selective retrieval using key values, especially if large
    • sorting may be time-consuming
    • not suitable for volatile tables

Heap files are lists of unordered records of variable size. Although sharing a similar name, heap files are widely different from in-memory heaps.

Hash buckets

  • Hash functions calculate the address of the page in which the record is to be stored based on one or more fields in the record
    • hashing functions chosen to ensure that addresses are spread evenly across the address space
    • ‘occupancy’ is generally 40% to 60% of the total file size
    • unique address not guaranteed so collision detection and collision resolution mechanisms are required
  • Open addressing
  • Chained/unchained overflow
  • Pros and cons
    • efficient for exact matches on key field
    • not suitable for range retrieval, which requires sequential storage
    • calculates where the record is stored based on fields in the record
    • hash functions ensure even spread of data
    • collisions are possible, so collision detection and restoration is required

B+ trees

These are the most commonly used in practice.

  • Time taken to access any record is the same because the same number of nodes is searched
  • Index is a full index so data file does not have to be ordered
  • Pros and cons
    • versatile data structure – sequential as well as random access
    • access is fast
    • supports exact, range, part key and pattern matches efficiently
    • volatile files are handled efficiently because index is dynamic – expands and contracts as table grows and shrinks
    • less well suited to relatively stable files – in this case, ISAM is more efficient

ISAM

Data orientation

Most conventional relational databases use "row-oriented" storage, meaning that all data associated with a given row is stored together. By contrast, column-oriented DBMS store all data from a given column together in order to more quickly serve data warehouse-style queries. Correlation databases are similar to row-based databases, but apply a layer of indirection to map multiple instances of the same value to the same numerical identifier.

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.