FlashKeepers

Databases · College · College and University

Database Internals: B-Trees, LSM and Storage

B-tree and B-plus tree indexes, LSM trees, write-ahead logs, buffer pools, query planners and isolation anomalies.

About this set

35 basic cards for College Databases. It opens with "What is a B-tree?" and "In a B-tree of order m, what is the maximum number of keys per node?". Study it alongside the other College sets below.

35 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is a B-tree?
Show answerA self-balancing tree where each node can have multiple children and multiple keys, used for efficient disk-based indexing in databases.
In a B-tree of order m, what is the maximum number of keys per node?
Show answerm - 1 keys.
What property ensures all leaves in a B-tree are at the same depth?
Show answerThe balancing property that rebalances nodes during insertion and deletion.
How do B-plus trees differ from B-trees in data storage?
Show answerB-plus trees store actual data only in leaf nodes, while internal nodes contain only keys and pointers to child nodes.
Why are B-plus trees preferred for database indexing?
Show answerLeaf nodes are linked sequentially enabling efficient range queries and full scans, and all data resides at the same tree depth.
What is the search time complexity in a balanced B-tree with n keys?
Show answerO(log n) comparisons, with the actual number of disk I/Os proportional to tree height.
Describe the B-tree insertion process when a node is full.
Show answerThe node splits into two, the median key is promoted to the parent, and insertion continues recursively upward if the parent also overflows.
What must be maintained during B-tree deletion to keep the tree valid?
Show answerThe minimum occupancy invariant, which requires each non-root node to contain at least floor(m/2) - 1 keys, necessitating rebalancing through borrowing or merging.
Why is a range query efficient in a B-plus tree?
Show answerLeaf nodes are linked together sequentially, so after finding the start key, you can traverse the linked leaves linearly without revisiting internal nodes.
What is an LSM tree?
Show answerA data structure that optimizes writes by buffering changes in memory, then sequentially flushing sorted batches to disk as immutable files.
What is a memtable in an LSM tree?
Show answerAn in-memory data structure, typically a balanced tree or skip list, that buffers recent writes before being flushed to disk as an SSTable.
What is an SSTable?
Show answerA Sorted String Table, an immutable file on disk containing key-value pairs in sorted order, created when a memtable is flushed.
What is compaction in LSM trees?
Show answerThe process of merging overlapping SSTables into fewer SSTables while removing deleted keys, improving read performance at the cost of write overhead.
What is write amplification in LSM trees?
Show answerThe ratio of total bytes written to disk versus logical bytes written by the application, increased by repeated data movement during compaction.
How do LSM trees achieve lower write latency compared to B-trees?
Show answerLSM trees write sequentially to a memtable and log without immediate sorting, while B-trees perform random disk I/O to maintain sorted order.

20 more cards in the app

Study this set free