Algorithm Search⌘K

Storage and indexing

Problems

  • Index selection problem

    Choose a set of indexes that fits in a space budget and minimizes the estimated cost of a workload, updates included. NP-hard; tools use greedy search over optimizer estimates.

    1 languagesadvanced

Algorithms

  • AutoAdmin index selection

    Pick indexes for a workload by finding the best ones for each query, then growing a configuration greedily with what-if costs.

    O((n^m + k n) q k) worst · average1 languagesadvanced
  • Bulk loading a B+ tree

    Build a B+ tree from a set of entries by sorting them, packing them into leaves to a chosen fill factor, and building each index level from the level below. Each node is written once.

    O(N log N) worst1 languagesadvanced
  • DBMIN buffer management

    Chou and DeWitt's buffer policy: each file a query opens gets its own locality set of frames, sized and replaced by its reference pattern, and a query starts only if all sets fit.

    O(n + f) worst · average1 languagesadvanced
  • Word-aligned hybrid compression

    Compress a bitmap into literal and fill words of machine size, so that AND, OR and XOR run on the compressed form in time linear in the number of compressed words.

    O(p + q) worst · average1 languagesadvanced
  • Adaptive merging

    Build an index as a side effect of queries: sorted runs are created on the first scan and each range query merges its keys into the final index.

    O(g m log s + t log m + log N + a) worst · average1 languagesresearch

Data structures

  • Bitmap index

    An index that keeps, for each value of a column, a bit vector with one bit per row. Bitwise AND, OR and NOT then answer selections.

    O(c n / w) worst1 languagesintro
  • Buffer pool

    A fixed set of memory frames that cache disk pages, with a page table, pin counts, dirty bits and a replacement policy that picks a victim among the unpinned frames.

    O(n B) worst1 languagesintro
  • Heap file

    An unordered file of records in pages, with a page directory or two linked lists to find free space. It is the default storage of a table.

    1 languagesintro
  • Slotted page

    A page layout that keeps an array of slots at one end and variable-length records at the other. A record id is (page, slot), so records can move inside the page.

    O(n log n + p) worst1 languagesintro
  • Decomposition storage model

    Store each attribute of a table in its own file of values, in record order, so that a scan reads only the columns it needs. A whole record costs one page per column.

    1 languagescore
  • N-ary storage model

    Store each record contiguously in a slotted page, so that a whole row costs one page read. A scan of one column still reads every byte of every row.

    1 languagescore
  • Zone map

    The minimum and maximum of a column in each block of rows. A scan skips each block whose interval misses the predicate. It helps only when the data is sorted or clustered on the column.

    O(n) worst1 languagescore
  • Generalized search tree (GiST)

    A balanced tree template whose keys are predicates. Six key methods (Consistent, Union, Compress, Decompress, Penalty, PickSplit) turn it into a B+ tree, an R-tree or other indexes.

    O(n) worst1 languagesadvanced
  • Join index

    A stored binary relation of pairs of tuple identifiers (rid of r, rid of s) for the tuples of R and S that join. The join is read from it instead of recomputed, at a cost in updates.

    O(d) expected delete · insert1 languagesadvanced
  • PAX page layout

    Keep the records of a page in that page, as NSM does, but store their values by attribute in one minipage each, so that a scan of one attribute uses whole cache lines.

    1 languagesadvanced
  • Prefix B-tree

    A B+ tree on string keys whose separators are shortest separators, chosen inside a split interval, and whose nodes store keys without the prefix that their fences share.

    O(L log n) worst · average · best1 languagesadvanced
  • ALEX updatable learned index

    A learned index that supports inserts by gapped arrays at its leaves and by splitting and retraining nodes when they fill.

    O(h + C) worst1 languagesresearch
  • Bw-tree

    A latch-free B+ tree that changes pages by prepending delta records and installs them with compare-and-swap on a mapping table.

    O(h (c + log B)) worst · average1 languagesresearch
  • Learned index

    A model of the key distribution predicts where a key lies in a sorted array, with a stored error bound per model. A short search inside the bound finishes the lookup.

    O(log e) worst1 languagesresearch
  • PGM-index

    A learned index of recursive piecewise linear models with a guaranteed error bound, built optimally in one pass over the sorted keys.

    O(log m + log ε) worst · average1 languagesresearch

Techniques

  • Dictionary encoding

    Replace each value of a column by a small integer code from a dictionary of its distinct values. If the dictionary is sorted, the codes keep the order and range filters run on codes.

    1 languagescore
  • Frame-of-reference encoding

    Store the values of a block as small offsets from a base value of the block, packed in as few bits as the largest offset needs.

    1 languagescore
  • Late materialization

    In a column store, run the filters on single columns and pass lists of row positions through the plan. Fetch the other columns of a row only for the positions that survive.

    1 languagesadvanced
  • Partial index

    An index over only the rows that satisfy a predicate, which saves space and update cost when queries target that subset.

    1 languagesadvanced
  • What-if index analysis

    Estimate the benefit of an index without building it by giving the optimizer statistics of a hypothetical index and costing the plans.

    1 languagesadvanced
  • Database cracking

    Build an index as a side effect of queries. Each range query partitions only the pieces of a column copy that hold its bounds, so the column gets closer to sorted where queries go.

    1 languagesresearch

Concepts

  • Clustered index

    An index whose key order is the same as the physical order of the rows. A range query reads only the pages of the matching rows, not one page per row.

    1 languagesintro
  • Covering index

    An index that holds every column a query needs, so the query is answered from the index alone with no reads of the table. Extra columns can ride in the leaves only.

    intro

Definitions

  • Dense and sparse indexes

    A dense index has an entry for every search key value of the file. A sparse index has one entry per block, and it works only on a file sorted on the key.

    intro

Theorems

  • Five-minute rule

    Keep a page in memory if it is used again within the break-even interval, set by the price of memory, the price of a disk and its access rate. In 1987 it was about five minutes.

    core