0
0
SQLquery~5 mins

How an index works (B-tree mental model) in SQL - Quick Revision & Summary

Choose your learning style9 modes available
Recall & Review
beginner
What is the main purpose of an index in a database?
An index helps the database find data quickly, like a book's index helps you find a topic without reading every page.
Click to reveal answer
intermediate
Describe the structure of a B-tree used in database indexes.
A B-tree is a balanced tree with nodes containing keys and pointers. It keeps data sorted and allows fast searching by narrowing down where to look step-by-step.
Click to reveal answer
beginner
How does a B-tree index speed up searching for a value?
It starts at the top node, compares the value, and moves down the correct branch, skipping large parts of data, so it finds the value quickly without scanning everything.
Click to reveal answer
intermediate
Why is a B-tree called 'balanced'?
Because all leaf nodes are at the same depth, so the time to find any value is similar, preventing slow searches.
Click to reveal answer
advanced
What happens when a B-tree node becomes too full?
The node splits into two nodes and pushes a key up to the parent, keeping the tree balanced and efficient.
Click to reveal answer
What does a database index primarily do?
AStores all data in memory
BSpeeds up data retrieval
CDeletes duplicate data
DEncrypts the database
In a B-tree index, what is stored in the nodes?
AKeys and pointers to child nodes
BOnly data rows
CUser passwords
DDatabase logs
Why is a B-tree index called balanced?
AIt has the same number of keys in every node
BIt uses equal memory for all nodes
CAll leaf nodes are at the same depth
DIt stores data in alphabetical order
What happens when a B-tree node is full?
AIt deletes the oldest key
BIt stops accepting new data
CIt merges with another node
DIt splits and pushes a key up
How does a B-tree index improve search speed?
ABy narrowing search to branches step-by-step
BBy scanning every row quickly
CBy storing data in random order
DBy compressing data
Explain how a B-tree index helps a database find data quickly.
Think about how a phone book helps you find a name without reading every page.
You got /4 concepts.
    Describe what happens inside a B-tree when a node becomes too full.
    Imagine a bookshelf that gets too full and you add a new shelf to keep things organized.
    You got /4 concepts.