HOME

TheInfoList



OR:

Database tables A table is a collection of related data held in a table format within a database. It consists of columns and rows. In relational databases, and flat file databases, a ''table'' is a set of data elements (values) using a model of vertical colu ...
and indexes may be stored on disk in one of a number of forms, including ordered/unordered flat files,
ISAM ISAM (an acronym for indexed sequential access method) is a method for creating, maintaining, and manipulating computer files of data so that records can be retrieved sequentially or randomly by one or more keys. Indexes of key fields are mainta ...
, heap files, hash buckets, or
B+ tree A B+ tree is an m-ary tree with a variable but often large number of children per node. A B+ tree consists of a root, internal nodes and leaves. The root may be either a leaf or a node with two or more children. A B+ tree can be viewed as a ...
s. Each form has its own particular advantages and disadvantages. The most commonly used forms are
B-trees In computer science, a B-tree is a self-balancing tree data structure that maintains sorted data and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree generalizes the binary search tree, allowing for ...
and ISAM. Such forms or structures are one aspect of the overall schema used by a
database engine A database engine (or storage engine) is the underlying software component that a database management system (DBMS) uses to create, read, update and delete (CRUD) data from a database. Most database management systems include their own applicati ...
to store information.


Unordered

Unordered storage typically stores the records in the order they are inserted. Such storage offers good insertion
efficiency Efficiency is the often measurable ability to avoid wasting materials, energy, efforts, money, and time in doing something or in producing a desired result. In a more general sense, it is the ability to do things well, successfully, and without ...
(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 key In the relational model of databases, a primary key is a ''specific choice'' of a ''minimal'' set of attributes ( columns) that uniquely specify a tuple ( row) in a relation ( table). Informally, a primary key is "which attributes identify a recor ...
s, 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

Heap files are lists of unordered records of variable size. Although sharing a similar name, heap files are widely different from in-memory heaps. In-memory heaps are ordered, as opposed to heap files. * Simplest and most basic method ** insert efficient, with new records added at the end of the file, providing chronological order ** retrieval efficient when the handle to the memory is the address of the memory ** search 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


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


Data orientation

Most conventional
relational database A relational database is a (most commonly digital) database based on the relational model of data, as proposed by E. F. Codd in 1970. A system used to maintain relational databases is a relational database management system (RDBMS). Many relati ...
s use "row-oriented" storage, meaning that all data associated with a given row is stored together. By contrast,
column-oriented DBMS A column-oriented DBMS or columnar DBMS is a database management system (DBMS) that stores data tables by column rather than by row. Benefits include more efficient access to data when only querying a subset of columns (by eliminating the need to r ...
store all data from a given column together in order to more quickly serve
data warehouse In computing, a data warehouse (DW or DWH), also known as an enterprise data warehouse (EDW), is a system used for reporting and data analysis and is considered a core component of business intelligence. DWs are central repositories of integra ...
-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.


See also

*
Database index A database index is a data structure that improves the speed of data retrieval operations on a database table at the cost of additional writes and storage space to maintain the index data structure. Indexes are used to quickly locate data without ...
*
ISAM ISAM (an acronym for indexed sequential access method) is a method for creating, maintaining, and manipulating computer files of data so that records can be retrieved sequentially or randomly by one or more keys. Indexes of key fields are mainta ...
{{DEFAULTSORT:Database Storage Structures Databases Database management systems Database theory