B-tree
A B-tree is a balanced multiway search tree that maintains ordered keys and supports efficient searching, insertion, deletion, and sequential access.
Just Use Postgres!
A B-tree index is a balanced tree-based database index that supports ordered searches with logarithmic lookup complexity.
- How it is used
- Optimizes PostgreSQL equality, range, ordering, filtering, and aggregation queries through sorted indexed access.
- How deep it goes
- Explains tree structure, linked leaves, logarithmic lookup, execution plans, and practical SQL, without theoretical or implementation-level detail.
- Examples
- Demonstrates player scores, leaderboards, JSON pizza fields, and smartwatch heart-rate timestamps.
- What you can do after
- Apply it via PostgreSQL SQL and EXPLAIN to create indexes and verify sequential scans become index-assisted plans.
100 SQL Server Mistakes and How to Avoid Them
A B-tree is a balanced, multi-level tree structure whose pages contain keys and pointers for ordered data access.
- How it is used
- Explains how clustered and nonclustered indexes organize pages for seeks, scans, joins, filters, and aggregations.
- How deep it goes
- Defines root, intermediate, and leaf levels, then relates leaf contents to seeks, scans, fragmentation, and page splits.
- Examples
- Illustrates clustered seeks and scans with a B-tree diagram and contrasts a heap diagram with an ordered clustered-index diagram.
- What you can do after
- Evaluate/understand why key width, index type, and page condition affect read I/O and index-maintenance choices.
Read how 100 SQL Server Mistakes and How to Avoid Them explains B-tree →
PostgreSQL Mistakes and How to Avoid Them
A B-tree index is an ordered database index structure that efficiently supports equality, ordering, and compatible prefix-pattern lookups.
- How it is used
- Uses B-tree indexes to accelerate equality, ordering, and compatible prefix-pattern queries in PostgreSQL.
- How deep it goes
- Demonstrates expression indexes and EXPLAIN plans, but defers the B-tree algorithm’s internal mechanics.
- Examples
- Uses ArXiv JSONB metadata, title-prefix searches, substring searches, oversized abstracts, and DOI equality lookups.
- What you can do after
- Diagnose/debug with it by comparing predicates against index expressions and reading EXPLAIN ANALYZE output.
Read how PostgreSQL Mistakes and How to Avoid Them explains B-tree →
Grokking Relational Database Design
A B-tree is a self-balancing tree data structure that maintains sorted data and supports search, sequential access, insertion, and deletion in logarithmic time.
- How it is used
- Speeds database searches, filters, and sorted retrieval by maintaining additional structures over column values.
- How deep it goes
- Defines balancing, ordering, supported operations, and logarithmic performance, then explains index construction without detailing tree internals.
- Examples
- Uses movie-rating searches, ordering queries, release-date indexes, and combined rating-and-date indexes.
- What you can do after
- Operate/configure it by creating database indexes that support frequently searched or sorted columns.
Read how Grokking Relational Database Design explains B-tree →
Related concepts
- indexingkind of · Indexing is the organization or use of positions, keys, or lookup structures to identify and retrieve selected data or elements.
- Mapalternative to · A map is an associative data structure that stores key-value pairs and supports retrieving values by key.
- multikey indexincludes · A multikey index is a MongoDB index that creates index entries for the elements of an array field to support efficient queries on array contents.
- unique constraintproduced by · A data-model rule requiring designated values or combinations of values to distinguish the records or entities to which the rule applies.
- dateuses · A date is a calendar value identifying a particular day.
- composite indexused by · A composite index is a database index whose key contains multiple fields or columns, ordered according to the index definition.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



